fix(playground): update Monaco editor loader configuration and adjust editor reference type

This commit is contained in:
ngc2207 2025-01-05 05:41:48 +08:00
parent d1d8edb8cc
commit e1f51cf3b9

View File

@ -1,6 +1,5 @@
"use client";
import * as monaco from "monaco-editor";
import { connectToLanguageServer } from "@/lib/lsp";
import { useEffect, useRef, useState } from "react";
import { Editor, loader } from "@monaco-editor/react";
@ -41,12 +40,13 @@ int main() {
},
};
loader.config({ monaco });
loader.config({ paths: { vs: "/vs" } });
export default function PlaygroundPage() {
const [language, setLanguage] = useState<string>("c");
const file = files[language];
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const editorRef = useRef<any | null>(null);
const webSocketRef = useRef<WebSocket | null>(null);
const languageClientRef = useRef<MonacoLanguageClient | null>(null);