Related docs:
aic lsp starts the AICore language server over stdio using JSON-RPC 2.0.
Implementation source: src/lsp.rs.
Use aic lsp for long-lived interactive workflows:
- live diagnostics while editing
- hover/definition/completion driven refactors
- code actions and formatting inside editor loops
- CI and deterministic one-shot validation (prefer
aic check --json,aic fmt --check). - Batch automation that does not need interactive editor state.
aic lspClients should send initialize, then initialized, then normal text-document requests.
Minimal client launch config (stdio):
{
"command": "aic",
"args": ["lsp"],
"transport": "stdio"
}Minimal initialize request shape:
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"rootUri": "file:///workspace"
}
}From the server initialize response:
textDocumentSync(openClose, incrementalchange,save)hoverProviderdefinitionProviderdocumentSymbolProviderworkspaceSymbolProviderdocumentFormattingProvidercompletionProvider(trigger characters:.,:,#, and[)renameProvidercodeActionProvidersemanticTokensProvider(full)inlayHintProvidercallHierarchyProviderfoldingRangeProviderselectionRangeProvider
Attribute-specific support:
- Semantic decorator tokens for
#[...]attributes, including multi-line attribute forms. - Hover help for known framework/test attributes and generic preserved attributes.
- Snippet completions for framework route/extractor/validation attributes and attribute-test markers.
- Selection and folding ranges include attribute spans where they are present in source.
Supports configuration updates via workspace/didChangeConfiguration:
settings.aic.inlayHints.typeAnnotations(bool)settings.aic.inlayHints.effectAnnotations(bool)settings.aic.inlayHints.contractAnnotations(bool)
- No diagnostics:
- Ensure client sends
textDocument/didOpenandtextDocument/didChangewith full text updates.
- Ensure client sends
- Wrong module resolution:
- Ensure
rootUripoints at workspace root containingaic.tomland imports.
- Ensure
- Non-deterministic local editor state:
- Re-check with
aic check <entry> --jsonas canonical confirmation.
- Re-check with
- Formatting/code-action mismatch:
- Verify the client supports
textDocument/formattingandtextDocument/codeAction. - Re-run
aic fmt <entry> --checkandaic check <entry> --jsonto confirm canonical backend behavior.
- Verify the client supports
Use aic lsp for interactive editing state, but treat one-shot CLI commands as the canonical gate before applying automated changes or reporting success:
aic lsp
# deterministic confirmation before commit/apply
aic fmt src/main.aic --check
aic check src/main.aic --json