mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-07-23 03:05:44 +00:00
Diagnostics are now cleared if a file is closed
This commit is contained in:
parent
c5fc9ffedd
commit
a4380969b7
2 changed files with 10 additions and 4 deletions
|
@ -19,7 +19,7 @@ export interface Config {
|
||||||
|
|
||||||
export let conf: Partial<Config> = {}
|
export let conf: Partial<Config> = {}
|
||||||
|
|
||||||
connection.onDidChangeConfiguration(async (change) => {
|
export const onConfigChange = async (change) => {
|
||||||
const temp = change.settings.mcglsl as Config
|
const temp = change.settings.mcglsl as Config
|
||||||
conf = {shaderpacksPath: temp['shaderpacksPath'], glslangPath: temp['glslangValidatorPath']}
|
conf = {shaderpacksPath: temp['shaderpacksPath'], glslangPath: temp['glslangValidatorPath']}
|
||||||
try {
|
try {
|
||||||
|
@ -68,4 +68,4 @@ connection.onDidChangeConfiguration(async (change) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
import * as vsclang from 'vscode-languageserver'
|
import * as vsclang from 'vscode-languageserver'
|
||||||
import * as vsclangproto from 'vscode-languageserver-protocol'
|
import * as vsclangproto from 'vscode-languageserver-protocol'
|
||||||
import { Config } from './config'
|
|
||||||
import { completions } from './completionProvider'
|
import { completions } from './completionProvider'
|
||||||
import { preprocess, ext, formatURI } from './linter'
|
import { preprocess, ext, formatURI } from './linter'
|
||||||
import { exec, execSync } from 'child_process'
|
import { exec, execSync } from 'child_process'
|
||||||
|
@ -10,7 +9,10 @@ import { platform } from 'os'
|
||||||
import { createWriteStream, chmodSync, createReadStream, unlinkSync } from 'fs'
|
import { createWriteStream, chmodSync, createReadStream, unlinkSync } from 'fs'
|
||||||
import * as unzip from 'unzip'
|
import * as unzip from 'unzip'
|
||||||
|
|
||||||
export const connection = vsclang.createConnection(new vsclang.IPCMessageReader(process), new vsclang.IPCMessageWriter(process))
|
export let connection: vsclang.IConnection
|
||||||
|
connection = vsclang.createConnection(new vsclang.IPCMessageReader(process), new vsclang.IPCMessageWriter(process))
|
||||||
|
|
||||||
|
import { Config, onConfigChange } from './config'
|
||||||
|
|
||||||
export const documents = new vsclang.TextDocuments()
|
export const documents = new vsclang.TextDocuments()
|
||||||
documents.listen(connection)
|
documents.listen(connection)
|
||||||
|
@ -32,6 +34,8 @@ documents.onDidOpen((event) => onEvent(event.document))
|
||||||
|
|
||||||
documents.onDidSave((event) => onEvent(event.document))
|
documents.onDidSave((event) => onEvent(event.document))
|
||||||
|
|
||||||
|
documents.onDidClose((event) => connection.sendDiagnostics({uri: event.document.uri, diagnostics: []}))
|
||||||
|
|
||||||
//documents.onDidChangeContent(onEvent)
|
//documents.onDidChangeContent(onEvent)
|
||||||
|
|
||||||
export function onEvent(document: vsclangproto.TextDocument) {
|
export function onEvent(document: vsclangproto.TextDocument) {
|
||||||
|
@ -43,6 +47,8 @@ export function onEvent(document: vsclangproto.TextDocument) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connection.onDidChangeConfiguration(onConfigChange)
|
||||||
|
|
||||||
connection.onCompletion((textDocumentPosition: vsclang.TextDocumentPositionParams) => completions)
|
connection.onCompletion((textDocumentPosition: vsclang.TextDocumentPositionParams) => completions)
|
||||||
|
|
||||||
connection.onCompletionResolve((item: vsclang.CompletionItem): vsclang.CompletionItem => completions[item.data - 1])
|
connection.onCompletionResolve((item: vsclang.CompletionItem): vsclang.CompletionItem => completions[item.data - 1])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue