Skip to content

Commit 070cd0e

Browse files
committed
add more debug statements
1 parent 1fd90fe commit 070cd0e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,6 @@ The following features are on my radar:
147147
- [ ] Hover info
148148
- [ ] Code actions
149149
- [ ] Better handling of context and cancellation
150-
- [ ] Add LSP server configuration options
150+
- [ ] Add LSP server configuration options and presets for common languages
151151
- [ ] Make a more consistent and scalable API for tools (pagination, etc.)
152+
- [ ] Create tools at a higher level of abstraction, combining diagnostics, code lens, hover, and code actions when reading definitions or references.

internal/watcher/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ func (w *WorkspaceWatcher) loadGitIgnore(workspacePath string) error {
4747
}
4848
return fmt.Errorf("error reading gitignore: %w", err)
4949
}
50-
log.Printf("DEBUG: .gitignore content:\n%s", string(content))
50+
if debug {
51+
log.Printf("DEBUG: .gitignore content:\n%s", string(content))
52+
}
5153

5254
ignore, err := gitignore.CompileIgnoreFile(gitignorePath)
5355
if err != nil {

main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"github.com/metoro-io/mcp-golang/transport/stdio"
2020
)
2121

22+
var debug = os.Getenv("DEBUG") != ""
23+
2224
type config struct {
2325
workspaceDir string
2426
lspCommand string
@@ -96,7 +98,9 @@ func (s *server) initializeLSP() error {
9698
return fmt.Errorf("initialize failed: %v", err)
9799
}
98100

99-
log.Printf("Server capabilities: %+v\n\n", initResult.Capabilities)
101+
if debug {
102+
log.Printf("Server capabilities: %+v\n\n", initResult.Capabilities)
103+
}
100104

101105
err = client.Initialized(s.ctx, protocol.InitializedParams{})
102106
if err != nil {
@@ -142,7 +146,9 @@ func main() {
142146
// Monitor parent process termination
143147
go func() {
144148
ppid := os.Getppid()
145-
log.Printf("Monitoring parent process: %d", ppid)
149+
if debug {
150+
log.Printf("Monitoring parent process: %d", ppid)
151+
}
146152

147153
ticker := time.NewTicker(100 * time.Millisecond)
148154
defer ticker.Stop()

0 commit comments

Comments
 (0)