8000 feat: add Go LSP configuration and code navigation documentation · coder/coder@52fa7f3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 52fa7f3

Browse files
committed
feat: add Go LSP configuration and code navigation documentation
Change-Id: I994c8ee8fa2c246808a9f68a86e83a6a3db6f8ac Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent f46d478 commit 52fa7f3

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

.claude/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"permissions": {
3+
"allow": [],
4+
"deny": [
5+
"mcp__go-language-server__edit_file"
6+
]
7+
}
8+
}

.mcp.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"mcpServers": {
3+
"go-language-server": {
4+
"type": "stdio",
5+
"command": "go",
6+
"args": [
7+
"run",
8+
"github.com/isaacphi/mcp-language-server@latest",
9+
"-workspace",
10+
"./",
11+
"-lsp",
12+
"go",
13+
"--",
14+
"run",
15+
"golang.org/x/tools/gopls@latest"
16+
],
17+
"env": {}
18+
}
19+
}
20+
}

CLAUDE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,50 @@ if errors.Is(err, errInvalidPKCE) {
270270
- Test both positive and negative cases
271271
- Use `testutil.WaitLong` for timeouts in tests
272272

273+
## Code Navigation and Investigation
274+
275+
### Using Go LSP Tools
276+
277+
When working with the Coder codebase, leverage Go Language Server Protocol tools for efficient code navigation:
278+
279+
1. **Find function definitions**:
280+
281+
```none
282+
mcp__go-language-server__definition symbolName
283+
```
284+
285+
- Example: `mcp__go-language-server__definition getOAuth2ProviderAppAuthorize`
286+
- Quickly jump to function implementations across packages
287+
288+
2. **Find symbol references**:
289+
290+
```none
291+
mcp__go-language-server__references symbolName
292+
```
293+
294+
- Locate all usages of functions, types, or variables
295+
- Understand code dependencies and call patterns
296+
297+
3. **Get symbol information**:
298+
299+
```none
300+
mcp__go-language-server__hover filePath line column
301+
```
302+
303+
- Get type information and documentation at specific positions
304+
305+
4. **When to use LSP vs other tools**:
306+
- **Use LSP for**: Following function calls, understanding package relationships, finding specific implementations
307+
- **Use Grep for**: Text-based searches, finding patterns across files
308+
- **Use Bash for**: Simple file operations, running tests, git commands
309+
310+
### Investigation Strategy
311+
312+
1. **Start with route registration** in `coderd/coderd.go` to understand API endpoints
313+
2. **Use LSP definition lookup** to trace from route handlers to actual implementations
314+
3. **Follow the middleware chain** to understand request processing flow
315+
4. **Check test files** for expected behavior and error patterns
316+
273317
## Testing Scripts
274318

275319
### OAuth2 Test Scripts

0 commit comments

Comments
 (0)
0