mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-08-31 05:47:22 +00:00
fixes virtual merged document not updating on changes
This commit is contained in:
parent
93e3d4ded2
commit
45bb16e429
3 changed files with 6 additions and 5 deletions
|
@ -36,8 +36,8 @@ export function virtualMergedDocument(e: Extension): Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
const docProvider = new class implements vscode.TextDocumentContentProvider {
|
const docProvider = new class implements vscode.TextDocumentContentProvider {
|
||||||
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>();
|
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>()
|
||||||
onDidChange = this.onDidChangeEmitter.event;
|
onDidChange = this.onDidChangeEmitter.event
|
||||||
|
|
||||||
provideTextDocumentContent(uri: vscode.Uri, __: vscode.CancellationToken): vscode.ProviderResult<string> {
|
provideTextDocumentContent(uri: vscode.Uri, __: vscode.CancellationToken): vscode.ProviderResult<string> {
|
||||||
return getVirtualDocument(uri.path)
|
return getVirtualDocument(uri.path)
|
||||||
|
@ -50,6 +50,7 @@ export function virtualMergedDocument(e: Extension): Command {
|
||||||
const uri = vscode.window.activeTextEditor.document.uri
|
const uri = vscode.window.activeTextEditor.document.uri
|
||||||
const path = vscode.Uri.parse('mcglsl:' + uri.path)
|
const path = vscode.Uri.parse('mcglsl:' + uri.path)
|
||||||
const doc = await vscode.workspace.openTextDocument(path)
|
const doc = await vscode.workspace.openTextDocument(path)
|
||||||
|
docProvider.onDidChangeEmitter.fire(path)
|
||||||
await vscode.window.showTextDocument(doc, {preview: true})
|
await vscode.window.showTextDocument(doc, {preview: true})
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,7 +53,7 @@ export class Extension {
|
||||||
|
|
||||||
registerCommand = (name: string, f: (e: Extension) => commands.Command) => {
|
registerCommand = (name: string, f: (e: Extension) => commands.Command) => {
|
||||||
const cmd = f(this)
|
const cmd = f(this)
|
||||||
this.context.subscriptions.push(vscode.commands.registerCommand('mcshader.'+name, cmd))
|
this.context.subscriptions.push(vscode.commands.registerCommand('mcglsl.'+name, cmd))
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivate = async () => {
|
deactivate = async () => {
|
||||||
|
|
|
@ -11,8 +11,8 @@ export class LanguageClient extends lsp.LanguageClient {
|
||||||
constructor(ext: Extension) {
|
constructor(ext: Extension) {
|
||||||
super('vscode-mc-shader', 'VSCode MC Shader', {
|
super('vscode-mc-shader', 'VSCode MC Shader', {
|
||||||
command: process.env['MCSHADER_DEBUG'] ?
|
command: process.env['MCSHADER_DEBUG'] ?
|
||||||
ext.context.asAbsolutePath(path.join('server', 'target', 'debug', 'vscode-mc-shader')) :
|
ext.context.asAbsolutePath(path.join('server', 'target', 'debug', 'mcshader-lsp')) :
|
||||||
path.join(ext.context.globalStoragePath, 'mcshader-lsp')
|
path.join(ext.context.globalStoragePath, 'mcshader-lsp')
|
||||||
}, {
|
}, {
|
||||||
documentSelector: [{scheme: 'file', language: 'glsl'}],
|
documentSelector: [{scheme: 'file', language: 'glsl'}],
|
||||||
outputChannel: lspOutputChannel,
|
outputChannel: lspOutputChannel,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue