-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indentation points #1
Comments
Currently,
I also have an additional indentation parameter (above what
I'm open to opinions on how you think this should behave. I'm working on indentation support for
Thanks, I'm glad you find it useful!
Currently, there is nothing in the mode to support folding lines. I could look into that, but it hadn't crossed my mind. |
I think I’d keep
Sometimes, with ada-mode, you’d type the final newline of a section and the whole section would re-format itself, folding included! And, automatically choosing where the folds go feels rather overbearing. So I wouldn’t worry. |
Thanks for the input, I'll keep the default for While it doesn't address folding, I did release a new version of I'm hoping this will be an improvement over the previous line-based indentation which would leave the buffer needing to be reformatted when multi-line constructs (i.e., case construction , package declaration, project declarations, etc.) were not syntactically correct when indentation was performed. If you don't mind me asking, how did you enable/configure folding? I poked around at the |
The new strategy feels very comfortable. I didn’t write the code for folding in gpr-mode (or ada-mode; the same engine, I believe). Long ago I wrote a formatter for Coral 66, which had concepts of single & parallel fold points (the parallel ones were for e.g. parameter lists, so that if one had to fold they all did). The engine laid out the output line from the left, laying exception handlers at the fold points; when it hit the end of the line, it raised an exception; the lowest handler would then convert itself to a fold (if parallel, ditto for all the siblings); start again at the beginning; repeat until the end of the input line is reached, then dump the line with the folds. I don’t remember how the indentation was managed, this was somewhere about 1995! One point - it turns out that the SPARK tool |
I personally thought it dramatically improved the indentation situation, so glad to hear you find it works well too.
That's quite interesting. I had to look up Coral 66 as I had never heard of it before. Sounds like it was at least somewhat inspirational for what became Ada. I feel like the wrapping engine you describe is partially how the indentation engine works (from a top-down perspective). I do wonder if the wrapping part might be covered by the Emacs I am curious if the following might get you close to what you're expecting. I thought that maybe
Thanks, I'll add it to the list in the next release. That variable is currently only used to adjust the syntax highlighting for variable/attribute/package references. For example something like "A.B.C'Attribute", it's ambiguous if "C" is a reference to a package in project "A.B" or if it is a reference to a child project. Since package names get special syntax highlighting, As a side note, I'm working on improving the indentation in the presence of syntax errors. It tries to match the nearest "case", "package", "project", etc. in order to anchor the indentation, when there are syntax errors. So far, it works quite well when writing a GPR from a top-down perspective. Additionally, I'm working on some completion functionality. Currently I have package/project names after "end" (which completes for the name at the beginning of the project/package) as well as the name for packages (which pulls it's suggestions from Just as quick demonstration, the following shows the behavior in my current work-in-progress updates (not yet officially available): |
Just FYI, there is a new release which includes the above demonstrated functionality. In addition I've added casing commands and auto-casing support. Auto-casing is implemented as a minor mode ( |
I suspect you're running with the GPR LS enabled and that is providing some of this. For example, I'm not quite sure the Intellisense feature you're referring to, but it very well could be the completions provided by the language server being presented via As a note, I'd like to point out some performance issues with the language server, as documented in this issue.
This sounds like you have
That looks fine to me. That configuration worked and enables auto-casing when I drop it into my configuration. Does this work when you enable it manually? (
That's a diagnostic coming from the GPR LS (and you should see that in VSCode as well). It looks like this might have been fixed recently in commit AdaCore/ada_language_server@bbe2f54 |
gpr-mode indented like these:
but gpr-ts-mode like these:
It looks as though gpr-mode treats for-use statements rather like expressions, whereas gpr-ts-mode indents to the first token after
use
.I don’t say there’s anything wrong, just something I’ll need to get used to .. well worth the effort, thank you!
Looking at the second example, does gpr-ts-mode have a line length (like the 79 in ada-mode) that it’ll automatically fold long lines to, or does it require the user to insert newlines where they want the folds?
The text was updated successfully, but these errors were encountered: