LSP Integration
Creor integrates with language servers through the Language Server Protocol (LSP). When a language server is active for your project, the agent can use it to navigate code with the same precision as your editor's go-to-definition, find-references, and symbol search features.
Language servers run automatically when you open a project -- they are the same language servers that power the editor's IntelliSense, diagnostics, and code navigation. The agent accesses them through the LSP tool, which wraps common language server operations into a single tool interface.
Note
Symbol Lookup
Symbol lookup lets the agent search for functions, classes, interfaces, variables, and other symbols across your entire project. This is faster and more accurate than grep for finding code definitions because it understands language semantics.
Workspace Symbol Search
The agent can search for symbols by name across the entire workspace. This returns all matching definitions with their file locations, making it easy to navigate large codebases.
# Find all symbols matching "UserService" lsp operation="workspaceSymbol" query="UserService" # Results might include: # - class UserService (src/services/user.ts:15) # - interface IUserService (src/types/services.ts:42) # - const userService (src/di/container.ts:88)
Document Symbols
For a specific file, the agent can request all symbols defined in that file. This provides a structured outline of classes, functions, interfaces, and variables.
# Get all symbols in a file lsp operation="documentSymbol" uri="src/services/user.ts" # Returns the file's structure: # - class UserService # - constructor() # - findById(id: string) # - create(data: CreateUserDto) # - update(id: string, data: UpdateUserDto) # - delete(id: string)
Go to Definition
The agent can jump to the definition of any symbol -- a function, class, variable, type, or imported module. This is critical for understanding code that references abstractions defined elsewhere.
# Find where a function is defined lsp operation="definition" uri="src/routes/users.ts" line=23 character=15 # Returns: src/services/user.ts:42:2
The agent uses go-to-definition when it needs to understand what a function does before modifying code that calls it, or when it needs to trace the implementation behind an interface.
Find References
Find references returns every location where a symbol is used across the project. The agent uses this when renaming symbols, understanding the blast radius of a change, or finding all callers of a function.
# Find all usages of a function lsp operation="references" uri="src/services/user.ts" line=42 character=8 # Returns all files and locations where findById is called: # - src/routes/users.ts:23:15 # - src/routes/admin.ts:67:22 # - src/middleware/auth.ts:31:10 # - tests/services/user.test.ts:45:8
Why This Matters
Without find-references, the agent would need to grep for the symbol name, which catches string matches but misses renamed imports, aliases, and method overrides. LSP references are semantically accurate because they understand the language's type system and scope rules.
Test Discovery
The agent can discover tests in your project using a combination of glob patterns, file naming conventions, and LSP symbols. This lets it find the right test file for a given source file and identify which tests cover a specific function.
Discovery Strategies
- Convention-based: Looks for files matching *.test.ts, *.spec.ts, __tests__/*.ts alongside source files.
- Co-located tests: Finds test files in the same directory as the source file (e.g., utils.ts and utils.test.ts).
- Test directories: Checks for centralized test directories (tests/, __tests__/) that mirror the source structure.
- Symbol analysis: Uses LSP to find describe/it/test blocks that reference the function being modified.
When the agent modifies a function, it automatically looks for related tests to verify the change. If no tests exist, the agent may offer to create them.
Change Impact Analysis
Before making a change, the agent can analyze its potential impact by combining find-references with type information. This helps it understand which files will be affected and whether the change might break existing code.
What the Agent Checks
- All direct callers of the function or method being modified.
- All implementations of an interface being changed.
- All subclasses of a class being modified.
- All files that import the module being changed.
- Type compatibility -- whether a change to a function signature breaks existing callers.
This analysis is especially valuable for refactoring tasks. The agent can tell you how many files will be affected and what kind of changes will be needed in each one before starting the refactor.
Tip
Supported Languages
Code intelligence features depend on having a language server available. The following languages have built-in language server support in Creor.
| Language | Language Server | Features |
|---|---|---|
| TypeScript / JavaScript | tsserver (built-in) | Full LSP: definitions, references, symbols, diagnostics, rename, completions. |
| Python | Pylance / Pyright | Definitions, references, symbols, diagnostics, type checking. |
| Go | gopls | Definitions, references, symbols, diagnostics, formatting. |
| Rust | rust-analyzer | Definitions, references, symbols, diagnostics, inlay hints. |
| Java | Eclipse JDT.LS | Definitions, references, symbols, diagnostics, refactoring. |
| C / C++ | clangd | Definitions, references, symbols, diagnostics, formatting. |
| HTML / CSS | vscode-html-languageservice | Completions, diagnostics, formatting. |
| JSON | vscode-json-languageservice | Schema validation, completions. |
Additional language servers can be added through VS Code extensions. Any extension that provides LSP features will be accessible to the agent through the LSP tool.