-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support GNU-style indentation #303
Comments
That would require have more preferences than "tabSize". In vim, for example, you have these:
This is my interpretation, you can find the real doc by doing So at the very least, we will need a setting for:
|
Note I tried to use that indent in VSCode and Atom and they both do not support it at all. So I'm pretty sure monaco doesn't. I think the best thing would be to support auto indentation based on indent. (indent supports pretty much any indentation style). That way we could define the indentation in indent terms. That would be for C/C++ only however, so providing a hook for auto indent based on the language would help. So that clang-format could be used too for example. IMO TAB should default to autoindent the line too rather than placing whatever character. Or have an easy option to make it so. |
The behavior of the tab key could be configurable, but I think we should always have a basic mode where tab just indents manually. We won't always know the language being edited and know how to indent it, so we need to have a solid way for the user to do whatever they want. After that, we can get more fancy for some languages we want to have better support for. |
Should we file an issue with the monaco project to show that there is interest in supporting this kind of behavior? |
I'm not sure this should go into the editor directly ? |
formatting is part of the LSP and is already in Clangd although I don't think its possible to configure it well. It might be better to experiment with clang-format and document what's missing there. |
IIRC clang-format supports the gnu indent style, but not the actual formatting of GDB code. I wonder if it could do indent only |
The current issue is not related to any language support. It should be possible to set some preferences such that if the user creates a new .txt file and presses tab a few times, Theia follows the rules outlined above. So let's say you pressed tab a few times in an empty plain text file, it would successively contain this: Press tab once:
and again:
and again:
and again:
I suppose it will be possible for some language support to override this if the language dictates a standard, but it should still be possible to set the preferences to alter the basic indentation behavior of all files. |
When working on GNU projects (e.g. GDB), we have to use a particular indent style. I think that style is funky enough that when we are able to support this, we will be able to support pretty much anything. I don't know if Monaco is flexible enough out of the box to support that only through configuration, that will have to be investigated.
Each indentation level is two spaces, so when you press tab or shift-tab, it should increase or reduce the indentation of by two spaces. However, when you reach 8 consecutive spaces, that should be replaced by a tab.
Here's an example of properly indented code:
Here's the same code with spaces replaced with
<s>
and tabs with<t>
To be clear, this issue is not about the editor being smart about where to place brackets or auto-ident (although that would be nice in the future), but just being able to specify what whitespaces are inserted when pressing tab.
The text was updated successfully, but these errors were encountered: