Comparing version 2.1.2 to 2.1.3
@@ -16,2 +16,3 @@ /****************************************************************************** | ||
this.lines = [[]]; | ||
this.length = 0; | ||
if (typeof defaultIndent === 'string') { | ||
@@ -27,2 +28,5 @@ this.defaultIndentation = defaultIndent; | ||
} | ||
get contentLength() { | ||
return this.length; | ||
} | ||
get currentLineNumber() { | ||
@@ -36,3 +40,3 @@ return this.lines.length - 1; | ||
return { | ||
offset: this.content.length, | ||
offset: this.contentLength, | ||
line: this.currentLineNumber, | ||
@@ -46,2 +50,3 @@ character: this.currentLineContent.length | ||
this.lines[this.currentLineNumber].push(value); | ||
this.length += value.length; | ||
if (beforePos) { | ||
@@ -72,2 +77,3 @@ this.indentPendingTraceRegions(beforePos); | ||
resetCurrentLine() { | ||
this.length -= this.lines[this.currentLineNumber].join('').length; | ||
this.lines[this.currentLineNumber] = []; | ||
@@ -74,0 +80,0 @@ this.pendingIndent = true; |
@@ -76,2 +76,6 @@ /****************************************************************************** | ||
buildEdits(): SemanticTokens | SemanticTokensDelta; | ||
/** | ||
* Flushes the cached delta token values | ||
*/ | ||
flush(): void; | ||
private applyTokens; | ||
@@ -78,0 +82,0 @@ private compareTokens; |
@@ -80,2 +80,8 @@ /****************************************************************************** | ||
} | ||
/** | ||
* Flushes the cached delta token values | ||
*/ | ||
flush() { | ||
this.previousResult(this.id); | ||
} | ||
applyTokens() { | ||
@@ -122,2 +128,3 @@ for (const token of this._tokens.sort(this.compareTokens)) { | ||
this.currentTokensBuilder = this.getDocumentTokensBuilder(document); | ||
this.currentTokensBuilder.flush(); | ||
await this.computeHighlighting(document, this.createAcceptor(), cancelToken); | ||
@@ -130,2 +137,3 @@ return this.currentTokensBuilder.build(); | ||
this.currentTokensBuilder = this.getDocumentTokensBuilder(document); | ||
this.currentTokensBuilder.flush(); | ||
await this.computeHighlighting(document, this.createAcceptor(), cancelToken); | ||
@@ -132,0 +140,0 @@ return this.currentTokensBuilder.build(); |
@@ -6,3 +6,3 @@ /****************************************************************************** | ||
******************************************************************************/ | ||
import { CancellationTokenSource, DiagnosticSeverity, MarkupContent } from 'vscode-languageserver'; | ||
import { DiagnosticSeverity, MarkupContent } from 'vscode-languageserver'; | ||
import { escapeRegExp } from '../utils/regex-util.js'; | ||
@@ -501,2 +501,5 @@ import { URI } from '../utils/uri-util.js'; | ||
const tokenProvider = services.lsp.SemanticTokenProvider; | ||
if (!tokenProvider) { | ||
throw new Error('No semantic token provider provided!'); | ||
} | ||
return async (text, options) => { | ||
@@ -508,3 +511,3 @@ const { output: input, ranges } = replaceIndices({ | ||
const params = { textDocument: { uri: document.textDocument.uri } }; | ||
const tokens = await tokenProvider.semanticHighlight(document, params, new CancellationTokenSource().token); | ||
const tokens = await tokenProvider.semanticHighlight(document, params); | ||
return { tokens: SemanticTokensDecoder.decode(tokens, document), ranges }; | ||
@@ -511,0 +514,0 @@ }; |
{ | ||
"name": "langium", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "A language engineering tool for the Language Server Protocol", | ||
@@ -5,0 +5,0 @@ "homepage": "https://langium.org", |
@@ -25,2 +25,3 @@ /****************************************************************************** | ||
private lines: string[][] = [[]]; | ||
private length: number = 0; | ||
@@ -39,2 +40,6 @@ constructor(defaultIndent?: string | number) { | ||
get contentLength(): number { | ||
return this.length; | ||
} | ||
get currentLineNumber(): number { | ||
@@ -50,3 +55,3 @@ return this.lines.length - 1; | ||
return { | ||
offset: this.content.length, | ||
offset: this.contentLength, | ||
line: this.currentLineNumber, | ||
@@ -61,2 +66,3 @@ character: this.currentLineContent.length | ||
this.lines[this.currentLineNumber].push(value); | ||
this.length += value.length; | ||
if (beforePos) { | ||
@@ -92,2 +98,3 @@ this.indentPendingTraceRegions(beforePos); | ||
resetCurrentLine() { | ||
this.length -= this.lines[this.currentLineNumber].join('').length; | ||
this.lines[this.currentLineNumber] = []; | ||
@@ -94,0 +101,0 @@ this.pendingIndent = true; |
@@ -156,2 +156,9 @@ /****************************************************************************** | ||
/** | ||
* Flushes the cached delta token values | ||
*/ | ||
flush(): void { | ||
this.previousResult(this.id); | ||
} | ||
private applyTokens(): void { | ||
@@ -209,2 +216,3 @@ for (const token of this._tokens.sort(this.compareTokens)) { | ||
this.currentTokensBuilder = this.getDocumentTokensBuilder(document); | ||
this.currentTokensBuilder.flush(); | ||
await this.computeHighlighting(document, this.createAcceptor(), cancelToken); | ||
@@ -218,2 +226,3 @@ return this.currentTokensBuilder.build(); | ||
this.currentTokensBuilder = this.getDocumentTokensBuilder(document); | ||
this.currentTokensBuilder.flush(); | ||
await this.computeHighlighting(document, this.createAcceptor(), cancelToken); | ||
@@ -220,0 +229,0 @@ return this.currentTokensBuilder.build(); |
@@ -12,3 +12,3 @@ /****************************************************************************** | ||
import type { BuildOptions } from '../workspace/document-builder.js'; | ||
import { CancellationTokenSource, DiagnosticSeverity, MarkupContent } from 'vscode-languageserver'; | ||
import { DiagnosticSeverity, MarkupContent } from 'vscode-languageserver'; | ||
import { escapeRegExp } from '../utils/regex-util.js'; | ||
@@ -711,3 +711,6 @@ import { URI } from '../utils/uri-util.js'; | ||
const parse = parseHelper<T>(services); | ||
const tokenProvider = services.lsp.SemanticTokenProvider!; | ||
const tokenProvider = services.lsp.SemanticTokenProvider; | ||
if (!tokenProvider) { | ||
throw new Error('No semantic token provider provided!'); | ||
} | ||
return async (text, options) => { | ||
@@ -719,3 +722,3 @@ const { output: input, ranges } = replaceIndices({ | ||
const params: SemanticTokensParams = { textDocument: { uri: document.textDocument.uri } }; | ||
const tokens = await tokenProvider.semanticHighlight(document, params, new CancellationTokenSource().token); | ||
const tokens = await tokenProvider.semanticHighlight(document, params); | ||
return { tokens: SemanticTokensDecoder.decode(tokens, document), ranges }; | ||
@@ -722,0 +725,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 6 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 6 instances in 1 package
2873924
44781