-
Notifications
You must be signed in to change notification settings - Fork 29.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
Add SmartIndent capability #16998
Comments
This is a good feature to have. I was disappointed to learn that 📝 Since publishing that paper, I've managed to define behavior for Smart Indent in more generalized scenarios. However, the paper remains a good overview for the general functionality that a |
@sharwell Your paper talks about splitting a line which suggests you expect SmartIndent to define not just the indent for blank lines but also on what it does when pressing RETURN. This sounds like its also related to automatic doc-comment continuation and automatic generation of end constructs (for example In Visual Studio, the ISmartIndent only works with blank lines, but perhaps if implemented in VSCODE it could also allow overriding the behaviour for non-blank lines so that the right caret position can be set inside comment blocks. And if special logic is needed for the RETURN action, then another method to override that behaviour. |
💭 I thought in Visual Studio, To me, Smart Indent deals with two things:
I don't necessarily have an obvious idea for what the interface should look like, but I can tell you what should happen when Enter is pressed provided the interface exists for extensions. In Visual Studio, the answer could probably be provided in terms of a |
That's correct, I thought you also expected it to perform a text edit like how it trims the line or inserts a new comment prefix etc. |
Ah, no. I'm saying that I like your idea of supporting Smart Indent in new languages in VS Code, but I'd like to see it go one step farther than |
Hi, are there any updates on this issue? It makes vscode much harder to use with typical mouse interaction. |
Visual Studio has an extensibility point called SmartIndent:
https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.text.editor.ismartindent.aspx
This allows a language service to provide the editor, given a line, what the indentation level should be. If you click on a blank line in Visual Studio, it will automatically place the caret at the correct indent level based on the code above. This also works when using the arrow keys to move the caret. Currently in VSCode, it will place the caret at column 0 for blank lines.
This may come hand-in-hand with implementing virtual space (see #13960) as Visual Studio will not insert spaces, but just place the caret at the correct column in virtual space.
One thing to note is that in Visual Studio, when clicking on a blank line, the X position that you click at must be greater than the expected indentation column in order for this to work, otherwise it will place the caret at column 0. With the arrow keys, unless you are at column 0, your caret will always move to the correct indentation level for that blank line.
The text was updated successfully, but these errors were encountered: