-
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
Automatically align => while typing or when saving #177
Comments
Thanks for helping us prioritize this |
glennsarti
referenced
this issue
in glennsarti/puppet-vscode
Jul 15, 2019
This commit adds an auto-aligner for the hash rocket (=>) for .pp files. This feature is hidden behind the 'hashrocket' featureflag as it may have unintended consequences and reformat user's files unexpectedly. The auto-align triggers on the `>` character. * The provider then determines if the user is in a hashrocket. * It then looks at the preceeding and proceeding lines to determine the block of hash rockets to consider * Once it has block of lines, it determines the smallest hash rocket location and edits the text file appropriately.
I just moved from Vim native to vscode and was using https://github.com/rodjek/vim-puppet which did the auto aligning really well and would love to see this implemented. |
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 11, 2019
Previously only the main protocol.d.ts file was introspected for ruby classes however the LSP protocol is actually split of many files. This commit changes the introspection tool to parse all of the files and import them into the ruby lsp namespace.
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 11, 2019
Previously the language server did not need to act on client configuration and it was all passed in via the command line. This commit; * Introduces a new class (LanguageClient) which is responsible for handling the configuration of the client from the server * The language client stores the client capabilites and any settings at the client level, that the server consumes * The LanguageClient class can register features dynamically * Uses dynamic registration of the `workspace/didChangeConfiguration` method where available. * Understands the difference between the old Client Push settings model and the newer Server Pull settings model, and can adapt appropriately * Adds tests for these scenarios. Later commits will actually implement caching the required settings. This commit is just focused on the plumbing to get the settings from the client.
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 11, 2019
Previously the language server did not need to act on client configuration and it was all passed in via the command line. This commit; * Introduces a new class (LanguageClient) which is responsible for handling the configuration of the client from the server * The language client stores the client capabilites and any settings at the client level, that the server consumes * The LanguageClient class can register features dynamically * Uses dynamic registration of the `workspace/didChangeConfiguration` method where available. * Understands the difference between the old Client Push settings model and the newer Server Pull settings model, and can adapt appropriately * Adds tests for these scenarios. Later commits will actually implement caching the required settings. This commit is just focused on the plumbing to get the settings from the client.
jpogran
added a commit
that referenced
this issue
Sep 12, 2019
(GH-177) Add ability to fetch the client configuration
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
Previously capability registrations were assumed to only have one possible reqeuest per method however this isn't true. Also the request ID is needed in order to unregister a capability. This commit; * Modifies the Language Client to track registrations that are in progress and have completed * Now processes error messages so that registration tracking can fail tracked registrations * Adds tests for these scenarios
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
…ient Previously the message router was passed in as a method parameter however as almost all methods require the message router, this commit changes the initializer to pass in the message router at object create time.
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
Previously client capabilities could be dynamically registered. This commit adds the logic and track to dynamically unregister a capability; * Adds the unregister_capability and parse_unregister_capability_response! methods * Adds the client/unregisterCapability notification handler * Adds tests for unregistering
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
Previously the settings were passed directly from the response into the client for processing however this does not emulate the legacy settings hash. This commit adds the original scope onto the settings hash so it appears like the legacy hash e.g. puppet.editorservices.abc instead of editorserivces.abc
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
While technically the protocol does allow the server to send window/showMessage notifcations during initialization, it's better to send the warning at the end of initialization i.e. at the initialized notification.
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
Now that the Language Client can process client settings, and dynamic registrations it is now possible to setup the server to register to receive the onTypeFormatting request. This commit: * Responds to the 'puppet.editorService.formatOnType.enable' client setting * Dynamically registers the provider if dynamic registration is possible otherwise uses static registration * Adds a format_on_type method on the Language Client to track whether this feature is enabled * Adds dummy response to the `textDocument/onTypeFormatting` request * Adds tests for the client interacting with the settings
glennsarti
added a commit
to glennsarti/puppet-editor-services
that referenced
this issue
Sep 17, 2019
Previously the onTypeFormatting provider was created and responds to client settings, turning it on and off appropriately. This commit actually adds the on type formatter: * Only for puppet manifests (.pp) * Uses puppet-lint lexer to tokenise the document and uses the tokens to determine indenting * Will not operate if the document is over 4KB in size or the client is using tabs instead of spaces * Adds tests for the formatting
Almost there ... lots of behind-the-scenes changes to make before I could fix the hash-rockets. |
jpogran
added a commit
that referenced
this issue
Sep 18, 2019
(GH-177) Dynamically unregister capabilities
jpogran
added a commit
that referenced
this issue
Sep 18, 2019
(GH-177) Add registrations and settings for on type formatting
jpogran
added a commit
that referenced
this issue
Sep 18, 2019
(GH-177) Add auto-align hash rocket feature
And we're merged! Will be available next release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary of the new feature
Automatic => alignment, as I type, or when saving, or with a hotkey.
For example:
As a user
I would like to automatically automatically align
=>
as I type, or when saving, or with a hotkey.so that I don't have to remember to do it myself or run lint, then go back and hit space/tab until all hashes are properly aligned.
The text was updated successfully, but these errors were encountered: