Move lsp server to this repo (#5619)
This commit is contained in:
32
rust/kcl-language-server/client/src/commands.ts
Normal file
32
rust/kcl-language-server/client/src/commands.ts
Normal file
@ -0,0 +1,32 @@
|
||||
/* eslint suggest-no-throw/suggest-no-throw: 0 */
|
||||
import * as vscode from 'vscode'
|
||||
|
||||
import type { Cmd, CtxInit } from './ctx'
|
||||
import { spawnSync } from 'child_process'
|
||||
|
||||
export function serverVersion(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
if (!ctx.serverPath) {
|
||||
void vscode.window.showWarningMessage(
|
||||
`kcl-language-server server is not running`
|
||||
)
|
||||
return
|
||||
}
|
||||
const { stdout } = spawnSync(ctx.serverPath, ['--version'], {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
const versionString = stdout.slice(`kcl-language-server `.length).trim()
|
||||
|
||||
void vscode.window.showInformationMessage(
|
||||
`kcl-language-server version: ${versionString}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function openLogs(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
if (ctx.client.outputChannel) {
|
||||
ctx.client.outputChannel.show()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user