Uses the grammar marijn made :) (#2967)
* Add a Lezer KCL grammar * fmt Signed-off-by: Jess Frazelle <github@jessfraz.com> * make tsc happy Signed-off-by: Jess Frazelle <github@jessfraz.com> * turn off semantic tokens in favor of grammar Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu) * empty --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Marijn Haverbeke <marijn@haverbeke.berlin> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -71,6 +71,9 @@ export interface LanguageServerOptions {
|
||||
) => void
|
||||
|
||||
changesDelay?: number
|
||||
|
||||
doSemanticTokens?: boolean
|
||||
doFoldingRanges?: boolean
|
||||
}
|
||||
|
||||
export class LanguageServerPlugin implements PluginValue {
|
||||
@ -87,6 +90,9 @@ export class LanguageServerPlugin implements PluginValue {
|
||||
notification: LSP.NotificationMessage
|
||||
) => void
|
||||
|
||||
private doSemanticTokens: boolean = false
|
||||
private doFoldingRanges: boolean = false
|
||||
|
||||
private _defferer = deferExecution((code: string) => {
|
||||
try {
|
||||
// Update the state (not the editor) with the new code.
|
||||
@ -109,6 +115,9 @@ export class LanguageServerPlugin implements PluginValue {
|
||||
this.client = options.client
|
||||
this.documentVersion = 0
|
||||
|
||||
this.doSemanticTokens = options.doSemanticTokens ?? false
|
||||
this.doFoldingRanges = options.doFoldingRanges ?? false
|
||||
|
||||
if (options.changesDelay) {
|
||||
this.changesDelay = options.changesDelay
|
||||
}
|
||||
@ -220,6 +229,7 @@ export class LanguageServerPlugin implements PluginValue {
|
||||
|
||||
async getFoldingRanges(): Promise<LSP.FoldingRange[] | null> {
|
||||
if (
|
||||
!this.doFoldingRanges ||
|
||||
!this.client.ready ||
|
||||
!this.client.getServerCapabilities().foldingRangeProvider
|
||||
)
|
||||
@ -445,6 +455,7 @@ export class LanguageServerPlugin implements PluginValue {
|
||||
|
||||
async requestSemanticTokens() {
|
||||
if (
|
||||
!this.doSemanticTokens ||
|
||||
!this.client.ready ||
|
||||
!this.client.getServerCapabilities().semanticTokensProvider
|
||||
) {
|
||||
|
Reference in New Issue
Block a user