Log document that can't perform semanticTokens
This commit is contained in:
parent
021073e4fc
commit
4e9d171a23
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
# 1.9.8
|
||||
|
||||
- Log to output when document content exceed limit of semantic tokens.
|
||||
|
||||
# 1.9.7
|
||||
|
||||
- Change default of `javascript.autoClosingTags` and `typescript.autoClosingTags` to `true`.
|
||||
|
|
|
@ -29,9 +29,14 @@ export default class TypeScriptDocumentSemanticTokensProvider implements Documen
|
|||
}
|
||||
}
|
||||
|
||||
private logIgnored(uri: string): void {
|
||||
this.client.logger.warn(`${uri} content length exceed limit 100000`)
|
||||
}
|
||||
|
||||
async provideDocumentSemanticTokens(document: TextDocument, token: CancellationToken): Promise<SemanticTokens | null> {
|
||||
const file = this.client.toOpenedFilePath(document.uri)
|
||||
if (!file || document.getText().length > CONTENT_LENGTH_LIMIT) {
|
||||
this.logIgnored(document.uri)
|
||||
return null
|
||||
}
|
||||
return this._provideSemanticTokens(document, { file, start: 0, length: document.getText().length }, token)
|
||||
|
@ -40,6 +45,7 @@ export default class TypeScriptDocumentSemanticTokensProvider implements Documen
|
|||
async provideDocumentRangeSemanticTokens(document: TextDocument, range: Range, token: CancellationToken): Promise<SemanticTokens | null> {
|
||||
const file = this.client.toOpenedFilePath(document.uri)
|
||||
if (!file || (document.offsetAt(range.end) - document.offsetAt(range.start) > CONTENT_LENGTH_LIMIT)) {
|
||||
this.logIgnored(document.uri)
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue