2019-05-31 05:17:25

Only one thing wasn't clear for me...

@Rastislav Kiss
are you turning Ride in to an extension for vs? or VSCode?

Both things sound interesting, too.

thanks tongue

2019-05-31 23:09:58

@sanslash332: for VisualStudio. It has more features than vs code plus I am used to it and as I wrote in previous post, there is great cooperation between it and Jaws, i guess situation with NVDA is similar.

Best regards

Rastislav

2019-08-16 02:19:01 (edited by bgt lover 2019-08-16 02:25:46)

Hy!
I am sorry for not being able to visit this forum in a verry long while. Other things like my internet connection collapsing when I needed it most, my computer suddanly not being able to start on its own once I shut it down, and many others left aside, I am  working on a little project of my own, an implementation of (*gasp*) bgt leveraging the .net framework.
Regarding the discussion in this thread, I don't know how to write a vs plugin, so I am of little help there. What I can do instead is help this editor grow abit more by adding some features.
When I think about it though, it seems natural to want to integrate indentation based navigation in another popular editor instead of reinventing the wheal, but I strongly advise you to make ride  opensource because, if nothing else, c# beginners could learn by having an interesting, well structured program to study . If you think it a wise decission, no one is going to stop you from publishing the bgt version as well.
If you want to make a vs plugin out of ride, then I wish you good luck with it, but I for one am verry curious about your algorithm of parsing the indentation as well as how your editor keeps trac of where it is in the tree of nested blocs.
Before I forget, I have one more little question:
how can I attach a text to my profile so it appears under my posts ?

2019-08-16 05:23:14

The link to change your signature should be in your profile. You can get to it from the link on the top of the page, or you can click on your name in your own post.

2019-08-16 13:06:00 (edited by bgt lover 2019-08-16 13:13:27)

Strangely, the link isn't ammoungst my other profile details. Opinions?
Another of my little questions 
smile and=)
What does shades of newbie meen and why does it appear in front of all my posts?
How can I use smilies properly? Must I remember each code and what it does?

2019-08-18 03:41:53

Hi there,
@128: yes, if someone was interested in reading through the code, I could release it as opensource, although I should do some edits first, as there are few things you usually don't want in the code, but I hadn't the patience to make them correctly in time of writing. smile
Regarding the vs plugin, as time progressed, Ride has as well and now it's already in its alpha stage, where you can use VisualStudio as Ride and it surprisingly works. big_smile
There are still things, which need to get implemented, along with few bugs, which I am fixing now, but the core functionality - code navigation & editing already works in full symbiosis with VisualStudio tools like IntelliSense, Autocompletion, code formatting etc.
From this point of view it makes no sense for me to further develop the old application, which was intended  just to confirm that this whole concept could work.
But if anyone finds useful doing so, then I have nothing against it. I like the old Ride's structure, although it isn't perfect, it should be possible to add new features quite easily.
So I will see, when I get the time to release it. Till that, if you are interested in the indentation parsing algorithm, I can publish it right now, so you don't wait forever.
It's very simple, goes as follows:

1. Let expectedIndentation be 0, indentationStep 4 (as 4 spaces per level), beginningMark "{", endMark "}" and actLater false (just a support variable)
2. iterate through lines from top to bottom, where currentLine will contain currently processed line
2.1 let braces be sum of beginningMarks in currentLine minus sum of endMarks in currentLine
2.2 if currentLine starts with beginningMark, add braces*indentationStep to expectedIndentation, else set actLater to true
2.3 currentLine's indentation is now expectedIndentation, do whatever you want with it here, for example refactor the line, or anything else
2.4 if actLater is true, add braces*indentationStep to expectedIndentation and set actLater to false

That's all. smile
Yeah, and don't forget to already existing indentation, remove it or make the algorithm prepared, otherwise you might get strange results with figuring out if the currentLine starts with beginningMark.
Also, this version will work just in 99% cases. The rest 1% is, when the code has beginning or end Marks in quotes.
I don't mean like in

string.Format("{0} {1}", "Hello", "world!");

, those will cancel themselves, because they're nicely in pairs.
I mean, when there is check just for one of them, or there are no pairs in string. This will most likely to happen in parsing algorithms, where the format, which is being parsed contains those characters.
It is easy to modify the algorithm above to fix it, I just haven't written it explicitly, so you can better see how it works rather than what everything it checks.
The fix is simple, modified version could go as follows:

1. Let expectedIndentation be 0, indentationStep 4 (as 4 spaces per level), beginningMark "{", endMark "}", actLater false (just a support variable) and inQuotes false (just another support variable)
2. iterate through lines from top to bottom, where currentLine will contain currently processed line
2.1 let braces be 0
2.2 iterate through currentLine, where currentCharacter is the currently processed character
2.2.1 if currentCharacter is " or ', set inQuotes to its opposite value (usually using notation inQuotes=!inquotes; or something similar) and continue to the next iteration of the cycle
2.2.2 in case inQuotes is false, if currentCharacter is beginningMark, add 1 to braces, else if currentCharacter is endMark, subtract 1 from braces
2.3 if currentLine starts with beginningMark, add braces*indentationStep to expectedIndentation, else set actLater to true
2.4 currentLine's indentation is now expectedIndentation, do whatever you want with it here, for example refactor the line, or anything else
2.5 if actLater is true, add braces*indentationStep to expectedIndentation and set actLater to false

That's it, just a small change, isn't it? smile

This algorithm, as you can see, is quite simple, but from my experience very fast and reliable, while you can detect marking errors with it as well just by checking expectedIndentation. If it falls to minus while processing or remains non-zero after algorithm finished, there is probably something wrong with the code.
Further improvements like filtering marks in comments can be applied in the same way like the inQuotes protection, general idea remains the same.

After the code is reliably indented, it is easy to navigate it in a hierarchical way. Just keep information about current level and jump to right places, indentation can be used as a navigator for this purpose.
All Rides do it in this way, although there are differences between each generation, especially the lastone, where it's required to track not just what you're doing, but also what VisualStudio and other possible plugins do with the code under your hands, so it could be quite tricky sometimes to find a way how to do things and don't break anything.
But concept is the same.

Best regards

Rastislav

2019-08-18 05:43:07

This sounds osum. When can we expect a release of the ride as a vs plugin?
By the way, thank you for the indentation parsing algorithm. Now, for all I care, the old ride could go to the grave, but that is probably only me.