2025-02-19 10:22:27 +00:00
< div align = "center" >
2025-02-19 05:55:33 +00:00
# monaco-editor-lsp-next
2025-02-19 01:00:15 +00:00
2025-03-02 03:39:08 +00:00
✨ A seamless Next.js integration of the Monaco Editor with robust LSP support – all without SSR hassles.
2025-02-19 10:22:27 +00:00
2025-02-20 17:48:34 +00:00

2025-02-20 16:56:03 +00:00
2025-02-19 10:22:27 +00:00
< / div >
2025-03-02 03:39:08 +00:00
## ⚠️ Important Notice for WSL Users
2025-02-21 03:25:58 +00:00
2025-03-02 03:39:08 +00:00
### 🐧 WSL Network Configuration
2025-02-21 03:25:58 +00:00
2025-03-02 03:39:08 +00:00
If you are using Windows Subsystem for Linux (WSL), it is **essential** to switch your network mode to **Mirrored** . Failing to do so may prevent the Monaco Editor from connecting to the LSP language servers due to potential IPv6 configuration conflicts.
2025-02-21 03:25:58 +00:00
2025-03-02 03:39:08 +00:00
#### Steps to Switch to "Mirrored" Mode:
1. Open your WSL settings. ⚙️
2. Navigate to the **Network** section. 🌐
3. Change the network mode to **Mirrored** . 🔄
4. Restart WSL. 💻
2025-02-21 03:25:58 +00:00
2025-03-02 03:39:08 +00:00
Once these steps are completed, the Monaco Editor should connect smoothly to the LSP language servers. Enjoy! 🎉
2025-02-21 03:25:58 +00:00
2025-03-02 03:39:08 +00:00
## 🚀 Quick Start Guide
2025-02-19 10:22:27 +00:00
### 🐳 Using Docker (Recommended)
2025-02-19 01:00:15 +00:00
2025-02-19 10:22:27 +00:00
```sh
2025-03-02 03:39:08 +00:00
# Clone the repository
2025-02-19 10:22:27 +00:00
git clone https://github.com/cfngc4594/monaco-editor-lsp-next
cd monaco-editor-lsp-next
2025-02-19 01:00:15 +00:00
2025-03-02 03:39:08 +00:00
# Build and start containers in detached mode
2025-02-21 16:10:47 +00:00
docker compose up -d --build
2025-02-19 10:22:27 +00:00
```
2025-02-19 01:00:15 +00:00
2025-02-20 06:18:13 +00:00
### 🔧 Manual Setup
2025-02-19 01:00:15 +00:00
2025-02-19 10:22:27 +00:00
```sh
2025-03-02 03:39:08 +00:00
# Clone the repository
2025-02-19 10:22:27 +00:00
git clone https://github.com/cfngc4594/monaco-editor-lsp-next
cd monaco-editor-lsp-next
2025-02-19 10:29:04 +00:00
2025-03-02 03:39:08 +00:00
# Build and start specific containers (lsp-c and lsp-cpp) in detached mode
2025-02-21 16:10:47 +00:00
docker compose up -d --build lsp-c lsp-cpp
2025-02-19 10:29:04 +00:00
2025-03-02 03:39:08 +00:00
# Install project dependencies using the Bun package manager
2025-02-19 10:22:27 +00:00
bun install
2025-02-19 10:29:04 +00:00
2025-03-02 03:39:08 +00:00
# Launch the development server
2025-02-19 10:22:27 +00:00
bun run dev
```
2025-02-19 01:00:15 +00:00
2025-02-19 10:22:27 +00:00
## ⚙️ Configuration
2025-02-19 01:00:15 +00:00
2025-02-19 10:22:27 +00:00
### LSP Server Settings
2025-02-19 01:00:15 +00:00
2025-03-02 03:39:08 +00:00
| **Language** | **LSP Server** | **Port** |
|--------------|----------------|----------|
| `C` | `clangd` | `4594` |
| `C++` | `clangd` | `4595` |
## 📦 Package Compatibility
### 🎨 Shiki API Deprecation Notice
The syntax highlighting feature relies on `rehype-pretty-code` , which uses the deprecated `getHighlighter` API from `shiki` . This API was removed as of `shiki@3.0.0+` .
**Key Details:**
- **Affected Component:** `src/components/mdx-preview.tsx`
- **Dependency Chain:** `rehype-pretty-code` → `shiki@legacy`
- **Version Constraints:**
```bash
"shiki": "< =2.5.0"
"@shikijs/monaco": "< =2.5.0"
```
**Developer Note:**
Although newer shiki versions (3.0.0+) have introduced `createHighlighter` and `getSingletonHighlighter` APIs, upgrading manually may disrupt functionality until `rehype-pretty-code` adapts to these changes. For updates, please monitor the [rehype-pretty-code repository ](https://github.com/atomiks/rehype-pretty-code ).