Skip to content

Commit

Permalink
Default to cwd if no rootPath is provided by client
Browse files Browse the repository at this point in the history
  • Loading branch information
netmute committed Dec 6, 2024
1 parent a269d8f commit 54479fc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,22 @@ func handleInitialize(server *Server, req RPCRequest) {
return
}

// Convert RootURI to filesystem path
server.rootPath = uriToPath(params.RootURI)
if params.RootURI == "" {
// Use current working directory if RootURI is empty
cwd, err := os.Getwd()
if err != nil {
sendError(req.ID, -32603, "Failed to get current working directory", err.Error())
return
}
server.rootPath = cwd
} else {
// Convert RootURI to filesystem path
server.rootPath = uriToPath(params.RootURI)
}

// Load ctags entries
if err := server.scanRecursiveTags(); err != nil {
sendError(req.ID, -32603, "Internal error", err.Error())
sendError(req.ID, -32603, "Internal error while scanning tags", err.Error())
return
}

Expand Down

0 comments on commit 54479fc

Please sign in to comment.