lsp workspace stuff (#1677)

* some lsp shit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* more stuffs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* on open send close and open events

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update the path

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* send on close

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* on close project

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* update on close

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* initpromise

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add to wasm.ts

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Update src/lang/wasm.ts

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>

* restart lsps on failure

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add panic hook

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updartes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
Jess Frazelle
2024-03-11 17:50:31 -07:00
committed by GitHub
parent cd158f8db0
commit db5657a298
17 changed files with 436 additions and 137 deletions

View File

@ -7,6 +7,9 @@ import init, {
is_points_ccw,
get_tangential_arc_to_info,
program_memory_init,
ServerConfig,
copilot_lsp_run,
kcl_lsp_run,
} from '../wasm-lib/pkg/wasm_lib'
import { KCLError } from './errors'
import { KclError as RustKclError } from '../wasm-lib/kcl/bindings/KclError'
@ -279,3 +282,27 @@ export function programMemoryInit(): ProgramMemory {
throw kclError
}
}
export async function copilotLspRun(config: ServerConfig, token: string) {
try {
console.log('starting copilot lsp')
await copilot_lsp_run(config, token)
} catch (e: any) {
console.log('copilot lsp failed', e)
// We make it restart recursively so that if it ever dies after like
// 8 hours or something it will come back to life.
await copilotLspRun(config, token)
}
}
export async function kclLspRun(config: ServerConfig) {
try {
console.log('start kcl lsp')
await kcl_lsp_run(config)
} catch (e: any) {
console.log('kcl lsp failed', e)
// We make it restart recursively so that if it ever dies after like
// 8 hours or something it will come back to life.
await kclLspRun(config)
}
}