mirror of
https://github.com/Strum355/mcshader-lsp.git
synced 2025-08-31 13:57:27 +00:00
TS + Rust Integration
Rust Lang Server reads from stdin Client invokes the language server and sends requests It works!
This commit is contained in:
parent
b4a19265f8
commit
17f65ec5cf
9 changed files with 80 additions and 107 deletions
|
@ -3,34 +3,38 @@ import * as vscode from 'vscode'
|
|||
import * as vscodeLang from 'vscode-languageclient'
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
const serverModule = context.asAbsolutePath(path.join('server', 'out', 'server.js'))
|
||||
|
||||
const debugOpts = { execArgv: ['--nolazy', '--inspect=6009']}
|
||||
|
||||
const serverOpts: vscodeLang.ServerOptions = {
|
||||
run: {
|
||||
module: serverModule, transport: vscodeLang.TransportKind.ipc
|
||||
},
|
||||
debug: {
|
||||
module: serverModule, transport: vscodeLang.TransportKind.ipc, options: debugOpts
|
||||
}
|
||||
}
|
||||
const outputChannel = vscode.window.createOutputChannel('vscode-mc-shader')
|
||||
|
||||
const clientOpts: vscodeLang.LanguageClientOptions = {
|
||||
documentSelector: [{scheme: 'file', language: 'glsl'}],
|
||||
outputChannel: outputChannel,
|
||||
outputChannelName: 'vscode-mc-shader',
|
||||
synchronize: {
|
||||
configurationSection: 'mcglsl',
|
||||
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.{fsh,gsh,vsh,glsl}')
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
const serverOpts: vscodeLang.ServerOptions = {
|
||||
command: context.asAbsolutePath(path.join('server', 'target', 'debug', 'vscode-mc-shader')),
|
||||
|
||||
}
|
||||
|
||||
outputChannel.appendLine('starting language server...')
|
||||
|
||||
const langServer = new vscodeLang.LanguageClient('vscode-mc-shader', serverOpts, clientOpts)
|
||||
|
||||
context.subscriptions.push(langServer.start())
|
||||
|
||||
|
||||
await langServer.onReady()
|
||||
|
||||
langServer.onNotification('sampleText', (...nums: number[]) => {
|
||||
outputChannel.appendLine(`got notif: ${nums.join(' ')}`)
|
||||
})
|
||||
|
||||
langServer.onNotification('update-config', (dir: string) => {
|
||||
vscode.workspace.getConfiguration().update('mcglsl.glslangValidatorPath', dir, vscode.ConfigurationTarget.Global)
|
||||
})
|
||||
|
||||
outputChannel.appendLine('language server started!')
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue