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.lsp.reader.listen((data) => {
|
||||||
this.ws.send(JSON.stringify({ event: "lspOutput", output: 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 () => {
|
cleanup = async () => {
|
||||||
|
|
|
@ -147,6 +147,7 @@ implement main0 () = ()
|
||||||
main: "main.c",
|
main: "main.c",
|
||||||
compile: "clang -Wall -Wextra main.c -o main",
|
compile: "clang -Wall -Wextra main.c -o main",
|
||||||
run: "./main",
|
run: "./main",
|
||||||
|
lsp: "clangd",
|
||||||
template: `#include <stdio.h>
|
template: `#include <stdio.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
@ -22,6 +22,7 @@ const DEBUG = window.location.hash === "#debug";
|
||||||
interface RijuConfig {
|
interface RijuConfig {
|
||||||
id: string;
|
id: string;
|
||||||
monacoLang: string;
|
monacoLang: string;
|
||||||
|
main: string;
|
||||||
lspInit?: any;
|
lspInit?: any;
|
||||||
lspConfig?: any;
|
lspConfig?: any;
|
||||||
template: string;
|
template: string;
|
||||||
|
@ -151,6 +152,17 @@ async function main() {
|
||||||
term.write(message.output);
|
term.write(message.output);
|
||||||
return;
|
return;
|
||||||
case "lspStarted":
|
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(
|
const connection = createMessageConnection(
|
||||||
new RijuMessageReader(socket!),
|
new RijuMessageReader(socket!),
|
||||||
new RijuMessageWriter(socket!)
|
new RijuMessageWriter(socket!)
|
||||||
|
|
|
@ -30,6 +30,7 @@ beef
|
||||||
|
|
||||||
# C/C++
|
# C/C++
|
||||||
clang
|
clang
|
||||||
|
clangd
|
||||||
|
|
||||||
# C#
|
# C#
|
||||||
mono-mcs
|
mono-mcs
|
||||||
|
|
Loading…
Reference in New Issue