Language Server Protocol implementation for InterSystems ObjectScript using tower-lsp and tree-sitter.
Goal: provide editor-independent ObjectScript semantics for VS Code, Zed, Neovim, and other LSP clients without requiring a live InterSystems server connection.
- Workspace indexing for
.cls,.inc,.rtn,.mac, and.int - Multi-workspace support through LSP workspace folders, with deepest-parent routing per document
- Go-to-definition for ObjectScript variables with ProcedureBlock-aware private/public resolution
- Go-to-implementation for inherited and overridden methods
- Syntax diagnostics for tracked ObjectScript documents
- Mixed-language diagnostics for ObjectScript captured from XML
Implementationblocks - Refactor code actions for:
- dotted
DOrewrites - conditional rewrites
FORrewrites- document-scoped and workspace-scoped edits
- dotted
- Inheritance modeling and override index build
- Class dependency tracking via
objectscript/dependencies:- class dependencies (
Extends,Import) - method-call dependencies (
##class,$CLASSMETHOD,$METHOD, filtered self/dot calls) - variable dependencies (cross-class public variable refs)
- oref dependencies (
%New()-derived object refs and follow-on calls) - SQL dependencies (query, embedded SQL, and SQL Gateway references)
- class dependencies (
- One
ProjectStateis created per workspace folder - Two-phase semantic build:
- initial class/routine parse and symbol creation
- inheritance, variables, call extraction, and dependency tracker rebuild
- Public symbols live in
GlobalSemanticModel - Private symbols are tracked through
LocalSemanticModelandScopeTree - XML documents are tracked for diagnostics, but they do not enter the class/routine semantic rebuild pipeline
- Dependency data is stored per class in
ClassDependencyTracker
objectscript-lsp(root crate): LSP transport layer in src/main.rs, src/lsp.rs, and src/server.rscrates/objectscript-core: parsing, semantic model, workspace state, refactors, and dependency trackingcrates/objectscript-mcp: MCP server exposing core analysis tools over stdio JSON-RPCobjectscript-tests/: fixture corpus for inheritance, dependencies, navigation, and related regressions
- Standard requests:
textDocument/definitiontextDocument/implementationtextDocument/diagnostic
- Code actions and execute commands for refactor rewrites
- Custom request:
objectscript/dependencies
For full architecture docs, see:
Run the MCP server:
cargo run -p objectscript-mcpImplemented tools:
get_objectscript_dependencies- Inputs:
uri(required),className/class_name(optional),workspaceRoot/workspace_root(optional),refresh(optional) - Returns dependency tracker data (
class,method,variable,oref,sql) for one class or the whole workspace
- Inputs:
parse_objectscript_snippet- Inputs:
code(required),grammar(udlorroutine, aliasescls/core),maxNodes(optional) - Returns a tree-sitter-backed parse summary for grounded analysis
- Inputs:
query_objectscript_tree- Inputs:
query(required),codeoruri,grammar(udlorroutine, aliasescls/core),maxMatches,maxCapturesPerMatch,includeCaptureText - Compiles and runs a tree-sitter query and returns structured matches and captures
- Inputs:
cargo build
cargo testtree-sitter = 0.26.6tree-sitter-objectscript = 1.7.13tree-sitter-objectscript-routine = 1.7.13tree-sitter-objectscript-playground = 1.7.13tree-sitter-xml = 0.7.0
- Semantic diagnostics (undefined variables, unresolved symbols)
- Broader mixed-language support beyond XML
Implementationblocks - More lifecycle and incremental edit coverage
- Expanded semantic support for properties, parameters, queries, triggers, and storage
- Find references and symbol-oriented LSP features
- Formatting support beyond the current refactor rewrites