judge4c based on monaco-editor-lsp-next
- In the CodeEditor component, merged the default CODE_EDITOR_OPTIONS with dynamic options returned by useCodeEditorOption to support runtime font size and line height adjustments. - Additionally, added the useCodeEditorOption hook to useCodeEditor.ts to manage the state of font size and line height. - This allows users to dynamically adjust the editor's display properties. |
||
---|---|---|
docker/lsp/clangd | ||
public | ||
src | ||
.dockerignore | ||
.env.example | ||
.gitignore | ||
bun.lock | ||
components.json | ||
compose.yml | ||
demo.png | ||
Dockerfile | ||
eslint.config.mjs | ||
LICENSE | ||
next.config.ts | ||
package.json | ||
postcss.config.mjs | ||
README.md | ||
tailwind.config.ts | ||
tsconfig.json |
monaco-editor-lsp-next
✨ A Next.js integration of Monaco Editor with LSP support, free from SSR issues.
⚠️ Important Notice for WSL Users!
If you're using Windows Subsystem for Linux (WSL), it's crucial to switch your network mode to "Mirrored".
Otherwise, the Monaco Editor might fail to connect to the LSP language servers.
This is typically due to IPv6 configuration issues.
To change your WSL network mode, follow these steps:
- Open WSL settings. ⚙️
- Navigate to the "Network" section. 🌐
- Change the network mode to "Mirrored". 🔄
- Restart WSL. 💻
After completing these steps, the Monaco Editor should be able to connect to the LSP language servers without any problems. 🎉
🚀 Quick Start
🐳 Using Docker (Recommended)
# Clone repository
git clone https://github.com/cfngc4594/monaco-editor-lsp-next
cd monaco-editor-lsp-next
# Start containers in detached mode
docker compose up -d --build
🔧 Manual Setup
# Clone repository
git clone https://github.com/cfngc4594/monaco-editor-lsp-next
cd monaco-editor-lsp-next
# Start specific containers (lsp-c and lsp-cpp) in detached mode
docker compose up -d --build lsp-c lsp-cpp
# Install project dependencies using Bun package manager
bun install
# Run the development server
bun run dev
⚙️ Configuration
LSP Server Settings
Language | LSP Server | Port |
---|---|---|
C |
clangd |
4594 |
C++ |
clangd |
4595 |