Get clangd working for C/C++/Objective-C
This commit is contained in:
parent
404aeef235
commit
67cb37423c
|
@ -250,7 +250,9 @@ export class Session {
|
|||
this.lsp.reader.listen((data) => {
|
||||
this.ws.send(JSON.stringify({ event: "lspOutput", output: data }));
|
||||
});
|
||||
this.ws.send(JSON.stringify({ event: "lspStarted" }));
|
||||
this.ws.send(
|
||||
JSON.stringify({ event: "lspStarted", root: `/tmp/riju/${this.uuid}` })
|
||||
);
|
||||
}
|
||||
};
|
||||
cleanup = async () => {
|
||||
|
|
|
@ -147,6 +147,7 @@ implement main0 () = ()
|
|||
main: "main.c",
|
||||
compile: "clang -Wall -Wextra main.c -o main",
|
||||
run: "./main",
|
||||
lsp: "clangd",
|
||||
template: `#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -22,6 +22,7 @@ const DEBUG = window.location.hash === "#debug";
|
|||
interface RijuConfig {
|
||||
id: string;
|
||||
monacoLang: string;
|
||||
main: string;
|
||||
lspInit?: any;
|
||||
lspConfig?: any;
|
||||
template: string;
|
||||
|
@ -151,6 +152,17 @@ async function main() {
|
|||
term.write(message.output);
|
||||
return;
|
||||
case "lspStarted":
|
||||
if (typeof message.root !== "string") {
|
||||
console.error("Unexpected message from server:", message);
|
||||
return;
|
||||
}
|
||||
editor.setModel(
|
||||
monaco.editor.createModel(
|
||||
editor.getModel()!.getValue(),
|
||||
undefined,
|
||||
monaco.Uri.parse(`file://${message.root}/${config.main}`)
|
||||
)
|
||||
);
|
||||
const connection = createMessageConnection(
|
||||
new RijuMessageReader(socket!),
|
||||
new RijuMessageWriter(socket!)
|
||||
|
|
|
@ -30,6 +30,7 @@ beef
|
|||
|
||||
# C/C++
|
||||
clang
|
||||
clangd
|
||||
|
||||
# C#
|
||||
mono-mcs
|
||||
|
|
Loading…
Reference in New Issue