Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

fix(vscode): Text duplication when using VSCode git utilities #4338 #4376

Merged
merged 2 commits into from
Apr 15, 2023

Conversation

denbezrukov
Copy link
Contributor

@denbezrukov denbezrukov commented Apr 14, 2023

Summary

Fix #4338

It seems that we are receiving two different DidOpenTextDocument events with different URI schemes. The first one has the scheme "file", which indicates that the file is being accessed directly from the file system. The second one has the scheme "git", which suggests that the file is being accessed from a Git repository. After that we're receiving an change event.

rome_lsp::handlers::text_document::did_open{params=DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/lo.ts", query: None, fragment: None }, language_id: "typescript", version: 1, text: "console.log(\"before\");\n" } }}


│ ├─┐rome_lsp::handlers::text_document::did_open{params=DidOpenTextDocumentParams { text_document: TextDocumentItem { uri: Url { scheme: "git", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/Users/denis.bezrukov/Projects/my-app/src/lo.ts", query: Some(""), fragment: None }, language_id: "typescript", version: 1, text: "console.log(\"before\");\n" } }}

 │ ├─0ms TRACE rome_lsp::handlers::text_document old document: "console.log(\"before\");\n"
│ │ ├─0ms TRACE rome_lsp::handlers::text_document content changes: [TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 0, character: 15 }, end: Position { line: 0, character: 15 } }), range_length: Some(0), text: "fore" }]
│ │ ├─0ms TRACE rome_lsp::handlers::text_document new document: "console.log(\"beforefore\");\n"

I check how other tools handled their files:

Test Plan

???

Changelog

  • The PR requires a changelog line

Documentation

  • The PR requires documentation
  • I will create a new PR to update the documentation

@netlify
Copy link

netlify bot commented Apr 14, 2023

Deploy Preview for docs-rometools canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit b6640f7
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/6439af1ebebbd40008e7786e

Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Looks good to me! A test plan be merging the PR and make a nightly build, for example! Or, doing manual testing.

@denbezrukov denbezrukov merged commit 7cfaf39 into rome:main Apr 15, 2023
Conaclos added a commit that referenced this pull request Apr 16, 2023
…4376) (#4234)

fix(vscode): Text duplication when using VSCode git utilities #4338

Co-authored-by: Denis Bezrukov <6227442+denbezrukov@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Text duplication when using VSCode git utilities
2 participants