Skip to content
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

feature(lsp): implements incremental file updates #298

Merged
merged 2 commits into from
Feb 28, 2021

Conversation

baszalmstra
Copy link
Collaborator

Enables the language server to receive incremental file updates when text is being modified in an editor.

I bumped the rowan and text_unit crates. They output syntax and text range a bit different which causes all the changes in a lot of tests.

I also cleaned up conversion from lsp types to our types. Functions are now split over the to_lsp and from_lsp modules.

Depends on #293

@baszalmstra baszalmstra added the type: perf Changes that improve performance label Jan 15, 2021
@baszalmstra baszalmstra requested a review from Wodann January 15, 2021 10:35
@baszalmstra baszalmstra self-assigned this Jan 15, 2021
@baszalmstra baszalmstra changed the title Feat/incremental file update feat(lsp): implements incremental file updates Jan 15, 2021
@baszalmstra baszalmstra changed the title feat(lsp): implements incremental file updates feature(lsp): implements incremental file updates Jan 15, 2021
@codecov
Copy link

codecov bot commented Jan 15, 2021

Codecov Report

Merging #298 (12d006f) into master (63c257a) will increase coverage by 0.01%.
The diff coverage is 85.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #298      +/-   ##
==========================================
+ Coverage   80.80%   80.82%   +0.01%     
==========================================
  Files         240      241       +1     
  Lines       14584    14131     -453     
==========================================
- Hits        11785    11421     -364     
+ Misses       2799     2710      -89     
Impacted Files Coverage Δ
crates/mun_compiler/src/diagnostics_snippets.rs 84.00% <ø> (ø)
crates/mun_hir/src/in_file.rs 45.45% <ø> (ø)
crates/mun_language_server/src/capabilities.rs 0.00% <0.00%> (ø)
crates/mun_language_server/src/diagnostics.rs 62.96% <0.00%> (ø)
crates/mun_language_server/src/lib.rs 11.11% <ø> (ø)
crates/mun_language_server/src/state/protocol.rs 36.84% <0.00%> (-2.60%) ⬇️
crates/mun_syntax/src/lib.rs 63.04% <ø> (ø)
crates/mun_syntax/src/parsing/lexer.rs 94.91% <ø> (ø)
crates/mun_language_server/src/state.rs 88.35% <50.00%> (-0.06%) ⬇️
crates/mun_syntax/src/syntax_error.rs 66.66% <66.66%> (ø)
... and 46 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b83586a...f9634bb. Read the comment docs.

@Wodann
Copy link
Collaborator

Wodann commented Jan 19, 2021

Once the previous LSP PR is merged, can you rebase this? Quite a lot of files to re-review otherwise 😅

@baszalmstra baszalmstra force-pushed the feat/incremental_file_update branch from dbc892f to d36c727 Compare January 21, 2021 00:04
@baszalmstra baszalmstra force-pushed the feat/incremental_file_update branch from d36c727 to 13d722f Compare February 5, 2021 16:09
Copy link
Collaborator

@Wodann Wodann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially reviewed. I'll to review the remainder of this tomorrow

crates/mun_hir/src/line_index.rs Outdated Show resolved Hide resolved
@@ -88,6 +237,24 @@ mod tests {
);
assert_eq!(index.text_part(0, 2, &text, text_len), Some(text));
}
#[test]
fn test_text_part_utf16() {
let text = "a\n❤️\nb";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the emoji a UTF-16 character, but not a UTF-8 character?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baszalmstra, I'm just trying to understand the transition from UTF-8 to UTF-16

crates/mun_language_server/src/completion/context.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Wodann Wodann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple more requests

crates/mun_language_server/src/from_lsp.rs Outdated Show resolved Hide resolved
crates/mun_language_server/src/from_lsp.rs Outdated Show resolved Hide resolved
@baszalmstra baszalmstra force-pushed the feat/incremental_file_update branch from db2129e to 12d006f Compare February 26, 2021 15:15
@baszalmstra baszalmstra force-pushed the feat/incremental_file_update branch from 12d006f to f9634bb Compare February 28, 2021 12:47
@baszalmstra baszalmstra merged commit 1feebf0 into mun-lang:master Feb 28, 2021
@Wodann Wodann added type: feat New feature or request and removed type: perf Changes that improve performance labels Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feat New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants