fixes virtual merged document not updating on changes

This commit is contained in:
Noah Santschi-Cooney 2021-02-12 00:12:24 +00:00
parent 93e3d4ded2
commit 45bb16e429
No known key found for this signature in database
GPG key ID: 3B22282472C8AE48
3 changed files with 6 additions and 5 deletions

View file

@ -36,8 +36,8 @@ export function virtualMergedDocument(e: Extension): Command {
}
const docProvider = new class implements vscode.TextDocumentContentProvider {
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>();
onDidChange = this.onDidChangeEmitter.event;
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>()
onDidChange = this.onDidChangeEmitter.event
provideTextDocumentContent(uri: vscode.Uri, __: vscode.CancellationToken): vscode.ProviderResult<string> {
return getVirtualDocument(uri.path)
@ -50,6 +50,7 @@ export function virtualMergedDocument(e: Extension): Command {
const uri = vscode.window.activeTextEditor.document.uri
const path = vscode.Uri.parse('mcglsl:' + uri.path)
const doc = await vscode.workspace.openTextDocument(path)
docProvider.onDidChangeEmitter.fire(path)
await vscode.window.showTextDocument(doc, {preview: true})
}
}

View file

@ -53,7 +53,7 @@ export class Extension {
registerCommand = (name: string, f: (e: Extension) => commands.Command) => {
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 () => {

View file

@ -11,8 +11,8 @@ export class LanguageClient extends lsp.LanguageClient {
constructor(ext: Extension) {
super('vscode-mc-shader', 'VSCode MC Shader', {
command: process.env['MCSHADER_DEBUG'] ?
ext.context.asAbsolutePath(path.join('server', 'target', 'debug', 'vscode-mc-shader')) :
path.join(ext.context.globalStoragePath, 'mcshader-lsp')
ext.context.asAbsolutePath(path.join('server', 'target', 'debug', 'mcshader-lsp')) :
path.join(ext.context.globalStoragePath, 'mcshader-lsp')
}, {
documentSelector: [{scheme: 'file', language: 'glsl'}],
outputChannel: lspOutputChannel,