-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
support LSP TextDocumentSyncKind.Incremental #14431
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 LSP TextDocumentSyncKind.Incremental #14431
Conversation
1beee8c to
067216e
Compare
| @@ -0,0 +1 @@ | |||
| * Support LSP TextDocumentSyncKind.Incremental. ([@tmtm][]) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update this changelog entry to the following and squash your commits into one?
| * Support LSP TextDocumentSyncKind.Incremental. ([@tmtm][]) | |
| * [#14431](https://github.com/rubocop/rubocop/pull/14431): Support LSP `TextDocumentSyncKind.Incremental`. ([@tmtm][]) |
d9145f3 to
e188292
Compare
|
Please don't split the changes into separate commits for the new change entry. Can you squash them into a single commit? |
e188292 to
37b7d8c
Compare
37b7d8c to
620921b
Compare
|
Thank you. Let's proceed with this. |
|
@tmtm Unfortunately, this change is insufficient and, for example, the following situation causes problems.
# frozen_string_literal: true
RSpec.describe RuboCop::Cop::Style::Dir, :config do
context 'when using `#expand_path` and `#dirname`' do
it 'registers an offense' do
expect_offense(<<~RUBY)
File.expand_path(File.dirname(__FILE__))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `__dir__` to get an absolute path to the current file's directory.
RUBY
expect_correction(<<~RUBY)
__dir__
RUBY
end
+ byebug
it 'registers an offense with ::File' do
expect_offense(<<~RUBY)
::File.expand_path(::File.dirname(__FILE__))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `__dir__` to get an absolute path to the current file's directory.
RUBY
expect_correction(<<~RUBY)
__dir__
RUBY
end
end
# frozen_string_literal: true
RSpec.describe RuboCop::Cop::Style::Dir, :config do
context 'when using `#expand_path` and `#dirname`' do
it 'registers an offense' do
expect_offense(<<~RUBY)
File.expand_path(File.dirname(__FILE__))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `__dir__` to get an absolute path to the current file's directory.
RUBY
expect_correction(<<~RUBY)
__dir__
RUBY
end
+ byebug
+
+ it ug 'registers an offense with ::File' do
expect_offense(<<~RUBY)
::File.expand_path(::File.dirname(__FILE__))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `__dir__` to get an absolute path to the current file's directory.
RUBY
expect_correction(<<~RUBY)
__dir__
RUBY
end
endIs there a plan to fix this bug promptly? |
|
@koic I’m not sure what the cause is. I couldn’t reproduce it in my environment. 😢 |
|
Ah, I understood! When making quick edits at multiple positions in Emacs, |
|
@koic However, I won’t have time to fix it immediately, so please revert it. |
…on the LSP Follow-up to rubocop#14431 (comment) This PR fixes an unexpect diagnostic with `TextDocumentSyncKind.Incremental` on the LSP when multiple `contentChanges`. Since rubocop#14431 changed `TextDocumentSyncKind` from `Full` to `Incremental`, it is necessary to handle the possibility that `params[:contentChanges]` may contain multiple entries.
…on the LSP Follow-up to rubocop#14431 (comment) This PR fixes an unexpect diagnostic with `TextDocumentSyncKind.Incremental` on the LSP when multiple `contentChanges`. Since rubocop#14431 changed `TextDocumentSyncKind` from `Full` to `Incremental`, it is necessary to handle the possibility that `params[:contentChanges]` may contain multiple entries. Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_synchronization
…on the LSP Follow-up to rubocop#14431 (comment) This PR fixes an unexpect diagnostic with `TextDocumentSyncKind.Incremental` on the LSP when `contentChanges` contains multiple entries. Since rubocop#14431 changed `TextDocumentSyncKind` from `Full` to `Incremental`, it is necessary to handle the possibility that `params[:contentChanges]` may contain multiple entries. Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_synchronization
…on the LSP Follow-up to #14431 (comment) This PR fixes an unexpect diagnostic with `TextDocumentSyncKind.Incremental` on the LSP when `contentChanges` contains multiple entries. Since #14431 changed `TextDocumentSyncKind` from `Full` to `Incremental`, it is necessary to handle the possibility that `params[:contentChanges]` may contain multiple entries. Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_synchronization
Implemented support for TextDocumentSyncKind.Incremental in LSP, so that only text diffs are sent when changes are made in the editor.
Before submitting the PR make sure the following are checked:
[Fix #issue-number](if the related issue exists).master(if not - rebase it).bundle exec rake default. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.mdif the new code introduces user-observable changes. See changelog entry format for details.