Skip to content

Commit

Permalink
fix: ignore git diff documents for language server
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Feb 16, 2023
1 parent 399e519 commit 7ef50f1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/language-server/src/common/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ export function createDocuments(connection: vscode.Connection) {
const onDidCloses = new Set<(params: vscode.DidCloseTextDocumentParams) => void>();

connection.onDidOpenTextDocument(params => {

if (params.textDocument.uri.startsWith('git:/'))
return;

snapshots.uriSet(params.textDocument.uri, new IncrementalScriptSnapshot(
params.textDocument.uri,
params.textDocument.languageId,
Expand All @@ -197,6 +201,10 @@ export function createDocuments(connection: vscode.Connection) {
}
});
connection.onDidChangeTextDocument(params => {

if (params.textDocument.uri.startsWith('git:/'))
return;

const incrementalSnapshot = snapshots.uriGet(params.textDocument.uri);
if (incrementalSnapshot) {
if (params.contentChanges.every(vscode.TextDocumentContentChangeEvent.isIncremental)) {
Expand All @@ -219,6 +227,10 @@ export function createDocuments(connection: vscode.Connection) {
}
});
connection.onDidCloseTextDocument(params => {

if (params.textDocument.uri.startsWith('git:/'))
return;

snapshots.uriDelete(params.textDocument.uri);
for (const cb of onDidCloses) {
cb(params);
Expand Down

0 comments on commit 7ef50f1

Please sign in to comment.