-
Notifications
You must be signed in to change notification settings - Fork 21
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
Puppet profile document formatting #306
Comments
Thank you for the report @Vasista-Eranki, but I do not understand what you are asking here. Can you please expand upon your request? |
Hello James Consider the below example .. Notice the file resource has bad indented information for the content attribute.. When I try to collapse the resource, I observe the resource is not completely collapsed, instead it is collapsing the lines as shown below. I'm expecting the resource collapsing shall be looking for the curly braces' matching pair { } instead of the indented lines. |
Thank you for the additional detail. Unfortunately there isn't much more we can do here. If you port your example to other languages, you'll see similar behavior. It's an artifact of HERE blocks/strings (named differently depending on the language you're using), and how VS Code handles indentation. |
I wonder if we'll have to implement the code-folding Language Server feature... I did something similar for PowerShell. The downside is I'll need to use a puppet language lexer |
If only the ruby based puppet language implementation had a public lexer .... like the Go ones does :-) |
Previously the Puppet Lexer ignored whitespace and comments and did not generate any token information. This meant it could not be used for code formatting purposes. This commit adds a new lexer which sub-classes the original and emits tokens for comments. Later commits can use this lexer for operations like code folding and as-you-type formatting. This commit also memoizes the tokens in the document store so documents do not need to be lexed multiple times for the same version.
Previously the Language Server dod not provide code folding hints, and the client was left to use its defauly, typically indentation based. This commit: * Adds a manifest folding provider, which can extract code folding regions based on block comments, multiline comments and blocks of code ( { -> } and [ -> ] ) * Adds many tests to ensure that regions are detected correctly particuarly in nested situations, or within HEREDOC strings. * Note that this folding is only supported on Puppet 6.3.0 and above due to the needed features in the Puppet Langauge tokeniser
Now that there is a Puppet Manifest Folding provider available, the server capabilities need to be updated so that clients know to use it. This commit: * Creates a method on ServerCapabilities to determine if folding is supported by the server * Updates the Service Capabilities to advertise the 'foldingRangeProvider' capavility if it is supported but not dynamic registrations * Updates the Client Settings to send dynamic registrations 'textDocument/foldingRange' if supported * Adds a two new settings for Folding: Enabled and Show Last Line * Refactors the Language Client settings to make it easier to set defaults * Updated Server to respond to 'textDocument/foldingRange' requests Adds many tests for the message handler and language client for the new provider
Previously the Puppet Lexer ignored whitespace and comments and did not generate any token information. This meant it could not be used for code formatting purposes. This commit adds a new lexer which sub-classes the original and emits tokens for comments. Later commits can use this lexer for operations like code folding and as-you-type formatting. This commit also memoizes the tokens in the document store so documents do not need to be lexed multiple times for the same version.
Previously the Language Server dod not provide code folding hints, and the client was left to use its defauly, typically indentation based. This commit: * Adds a manifest folding provider, which can extract code folding regions based on block comments, multiline comments and blocks of code ( { -> } and [ -> ] ) * Adds many tests to ensure that regions are detected correctly particuarly in nested situations, or within HEREDOC strings. * Note that this folding is only supported on Puppet 6.3.0 and above due to the needed features in the Puppet Langauge tokeniser
Now that there is a Puppet Manifest Folding provider available, the server capabilities need to be updated so that clients know to use it. This commit: * Creates a method on ServerCapabilities to determine if folding is supported by the server * Updates the Service Capabilities to advertise the 'foldingRangeProvider' capavility if it is supported but not dynamic registrations * Updates the Client Settings to send dynamic registrations 'textDocument/foldingRange' if supported * Adds a two new settings for Folding: Enabled and Show Last Line * Refactors the Language Client settings to make it easier to set defaults * Updated Server to respond to 'textDocument/foldingRange' requests Adds many tests for the message handler and language client for the new provider
(GH-306) Add a syntax aware code folding provider
Previously the Puppet Lexer ignored whitespace and comments and did not generate any token information. This meant it could not be used for code formatting purposes. This commit adds a new lexer which sub-classes the original and emits tokens for comments. Later commits can use this lexer for operations like code folding and as-you-type formatting. This commit also memoizes the tokens in the document store so documents do not need to be lexed multiple times for the same version.
Previously the Language Server dod not provide code folding hints, and the client was left to use its defauly, typically indentation based. This commit: * Adds a manifest folding provider, which can extract code folding regions based on block comments, multiline comments and blocks of code ( { -> } and [ -> ] ) * Adds many tests to ensure that regions are detected correctly particuarly in nested situations, or within HEREDOC strings. * Note that this folding is only supported on Puppet 6.3.0 and above due to the needed features in the Puppet Langauge tokeniser
Now that there is a Puppet Manifest Folding provider available, the server capabilities need to be updated so that clients know to use it. This commit: * Creates a method on ServerCapabilities to determine if folding is supported by the server * Updates the Service Capabilities to advertise the 'foldingRangeProvider' capavility if it is supported but not dynamic registrations * Updates the Client Settings to send dynamic registrations 'textDocument/foldingRange' if supported * Adds a two new settings for Folding: Enabled and Show Last Line * Refactors the Language Client settings to make it easier to set defaults * Updated Server to respond to 'textDocument/foldingRange' requests Adds many tests for the message handler and language client for the new provider
Issue Type: Bug
Puppet profile has several resources listed. a few of the resource strings have different indentation and the collapsing of resources is getting messy due to this..
I think, the collapsing of sections shall strictly adhere the { }.
VS Code version: Code 1.54.3 (2b9aebd5354a3629c3aba0a5f5df49f43d6689f8, 2021-03-15T10:55:45.459Z)
OS version: Windows_NT x64 10.0.19041
Extensions (45)
(3 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: