feat(lsp): resolve symbols across workspace files
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -309,6 +309,56 @@ type ServerCapabilities struct {
|
||||
DiagnosticProvider map[string]any `json:"diagnosticProvider,omitempty"`
|
||||
DocumentLinkProvider map[string]any `json:"documentLinkProvider,omitempty"`
|
||||
FoldingRangeProvider bool `json:"foldingRangeProvider,omitempty"`
|
||||
Workspace map[string]any `json:"workspace,omitempty"`
|
||||
}
|
||||
|
||||
// --- workspace ----------------------------------------------------------------
|
||||
|
||||
// initializeParams carries the workspace roots the client announces.
|
||||
type initializeParams struct {
|
||||
RootURI string `json:"rootUri"`
|
||||
WorkspaceFolders []workspaceFolder `json:"workspaceFolders"`
|
||||
}
|
||||
|
||||
// workspaceFolder is one root folder the client opened.
|
||||
type workspaceFolder struct {
|
||||
URI string `json:"uri"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// roots returns the workspace roots as filesystem paths: the workspace
|
||||
// folders when the client sends them, else the root URI.
|
||||
func (p initializeParams) roots() []string {
|
||||
var out []string
|
||||
for _, f := range p.WorkspaceFolders {
|
||||
if path := uriPath(f.URI); path != "" {
|
||||
out = append(out, path)
|
||||
}
|
||||
}
|
||||
if len(out) == 0 && p.RootURI != "" {
|
||||
if path := uriPath(p.RootURI); path != "" {
|
||||
out = append(out, path)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// didChangeWatchedFilesParams announces on-disk changes the client watched.
|
||||
type didChangeWatchedFilesParams struct {
|
||||
Changes []fileEvent `json:"changes"`
|
||||
}
|
||||
|
||||
// File change types (LSP FileChangeType).
|
||||
const (
|
||||
fileCreated = 1
|
||||
fileChanged = 2
|
||||
fileDeleted = 3
|
||||
)
|
||||
|
||||
// fileEvent is one created, changed or deleted file.
|
||||
type fileEvent struct {
|
||||
URI string `json:"uri"`
|
||||
Type int `json:"type"`
|
||||
}
|
||||
|
||||
// --- pull diagnostics ---------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user