@oh-my-pi/pi-coding-agent 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1629 -0
- package/README.md +1041 -0
- package/docs/compaction.md +403 -0
- package/docs/config-usage.md +113 -0
- package/docs/custom-tools.md +541 -0
- package/docs/extension-loading.md +1004 -0
- package/docs/hooks.md +867 -0
- package/docs/rpc.md +1040 -0
- package/docs/sdk.md +994 -0
- package/docs/session-tree-plan.md +441 -0
- package/docs/session.md +240 -0
- package/docs/skills.md +290 -0
- package/docs/theme.md +670 -0
- package/docs/tree.md +197 -0
- package/docs/tui.md +341 -0
- package/examples/README.md +21 -0
- package/examples/custom-tools/README.md +124 -0
- package/examples/custom-tools/hello/index.ts +20 -0
- package/examples/custom-tools/question/index.ts +84 -0
- package/examples/custom-tools/subagent/README.md +172 -0
- package/examples/custom-tools/subagent/agents/planner.md +37 -0
- package/examples/custom-tools/subagent/agents/scout.md +50 -0
- package/examples/custom-tools/subagent/agents/worker.md +24 -0
- package/examples/custom-tools/subagent/agents.ts +156 -0
- package/examples/custom-tools/subagent/commands/implement-and-review.md +10 -0
- package/examples/custom-tools/subagent/commands/implement.md +10 -0
- package/examples/custom-tools/subagent/commands/scout-and-plan.md +9 -0
- package/examples/custom-tools/subagent/index.ts +1002 -0
- package/examples/custom-tools/todo/index.ts +212 -0
- package/examples/hooks/README.md +56 -0
- package/examples/hooks/auto-commit-on-exit.ts +49 -0
- package/examples/hooks/confirm-destructive.ts +59 -0
- package/examples/hooks/custom-compaction.ts +116 -0
- package/examples/hooks/dirty-repo-guard.ts +52 -0
- package/examples/hooks/file-trigger.ts +41 -0
- package/examples/hooks/git-checkpoint.ts +53 -0
- package/examples/hooks/handoff.ts +150 -0
- package/examples/hooks/permission-gate.ts +34 -0
- package/examples/hooks/protected-paths.ts +30 -0
- package/examples/hooks/qna.ts +119 -0
- package/examples/hooks/snake.ts +343 -0
- package/examples/hooks/status-line.ts +40 -0
- package/examples/sdk/01-minimal.ts +22 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +44 -0
- package/examples/sdk/04-skills.ts +44 -0
- package/examples/sdk/05-tools.ts +90 -0
- package/examples/sdk/06-hooks.ts +61 -0
- package/examples/sdk/07-context-files.ts +36 -0
- package/examples/sdk/08-slash-commands.ts +42 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +55 -0
- package/examples/sdk/10-settings.ts +38 -0
- package/examples/sdk/11-sessions.ts +48 -0
- package/examples/sdk/12-full-control.ts +95 -0
- package/examples/sdk/README.md +154 -0
- package/package.json +89 -0
- package/src/bun-imports.d.ts +16 -0
- package/src/capability/context-file.ts +40 -0
- package/src/capability/extension.ts +48 -0
- package/src/capability/hook.ts +40 -0
- package/src/capability/index.ts +616 -0
- package/src/capability/instruction.ts +37 -0
- package/src/capability/mcp.ts +52 -0
- package/src/capability/prompt.ts +35 -0
- package/src/capability/rule.ts +56 -0
- package/src/capability/settings.ts +35 -0
- package/src/capability/skill.ts +49 -0
- package/src/capability/slash-command.ts +40 -0
- package/src/capability/system-prompt.ts +35 -0
- package/src/capability/tool.ts +38 -0
- package/src/capability/types.ts +166 -0
- package/src/cli/args.ts +259 -0
- package/src/cli/file-processor.ts +121 -0
- package/src/cli/list-models.ts +104 -0
- package/src/cli/plugin-cli.ts +661 -0
- package/src/cli/session-picker.ts +41 -0
- package/src/cli/update-cli.ts +274 -0
- package/src/cli.ts +10 -0
- package/src/config.ts +391 -0
- package/src/core/agent-session.ts +2178 -0
- package/src/core/auth-storage.ts +258 -0
- package/src/core/bash-executor.ts +197 -0
- package/src/core/compaction/branch-summarization.ts +315 -0
- package/src/core/compaction/compaction.ts +664 -0
- package/src/core/compaction/index.ts +7 -0
- package/src/core/compaction/utils.ts +153 -0
- package/src/core/custom-commands/bundled/review/index.ts +156 -0
- package/src/core/custom-commands/index.ts +15 -0
- package/src/core/custom-commands/loader.ts +226 -0
- package/src/core/custom-commands/types.ts +112 -0
- package/src/core/custom-tools/index.ts +22 -0
- package/src/core/custom-tools/loader.ts +248 -0
- package/src/core/custom-tools/types.ts +185 -0
- package/src/core/custom-tools/wrapper.ts +29 -0
- package/src/core/exec.ts +139 -0
- package/src/core/export-html/index.ts +159 -0
- package/src/core/export-html/template.css +774 -0
- package/src/core/export-html/template.generated.ts +2 -0
- package/src/core/export-html/template.html +45 -0
- package/src/core/export-html/template.js +1185 -0
- package/src/core/export-html/template.macro.ts +24 -0
- package/src/core/file-mentions.ts +54 -0
- package/src/core/hooks/index.ts +16 -0
- package/src/core/hooks/loader.ts +288 -0
- package/src/core/hooks/runner.ts +434 -0
- package/src/core/hooks/tool-wrapper.ts +98 -0
- package/src/core/hooks/types.ts +770 -0
- package/src/core/index.ts +53 -0
- package/src/core/logger.ts +112 -0
- package/src/core/mcp/client.ts +185 -0
- package/src/core/mcp/config.ts +248 -0
- package/src/core/mcp/index.ts +45 -0
- package/src/core/mcp/loader.ts +99 -0
- package/src/core/mcp/manager.ts +235 -0
- package/src/core/mcp/tool-bridge.ts +156 -0
- package/src/core/mcp/transports/http.ts +316 -0
- package/src/core/mcp/transports/index.ts +6 -0
- package/src/core/mcp/transports/stdio.ts +252 -0
- package/src/core/mcp/types.ts +228 -0
- package/src/core/messages.ts +211 -0
- package/src/core/model-registry.ts +334 -0
- package/src/core/model-resolver.ts +494 -0
- package/src/core/plugins/doctor.ts +67 -0
- package/src/core/plugins/index.ts +38 -0
- package/src/core/plugins/installer.ts +189 -0
- package/src/core/plugins/loader.ts +339 -0
- package/src/core/plugins/manager.ts +672 -0
- package/src/core/plugins/parser.ts +105 -0
- package/src/core/plugins/paths.ts +37 -0
- package/src/core/plugins/types.ts +190 -0
- package/src/core/sdk.ts +900 -0
- package/src/core/session-manager.ts +1837 -0
- package/src/core/settings-manager.ts +860 -0
- package/src/core/skills.ts +352 -0
- package/src/core/slash-commands.ts +132 -0
- package/src/core/system-prompt.ts +442 -0
- package/src/core/timings.ts +25 -0
- package/src/core/title-generator.ts +110 -0
- package/src/core/tools/ask.ts +193 -0
- package/src/core/tools/bash-interceptor.ts +120 -0
- package/src/core/tools/bash.ts +91 -0
- package/src/core/tools/context.ts +32 -0
- package/src/core/tools/edit-diff.ts +487 -0
- package/src/core/tools/edit.ts +140 -0
- package/src/core/tools/exa/company.ts +59 -0
- package/src/core/tools/exa/index.ts +63 -0
- package/src/core/tools/exa/linkedin.ts +59 -0
- package/src/core/tools/exa/mcp-client.ts +368 -0
- package/src/core/tools/exa/render.ts +200 -0
- package/src/core/tools/exa/researcher.ts +90 -0
- package/src/core/tools/exa/search.ts +338 -0
- package/src/core/tools/exa/types.ts +167 -0
- package/src/core/tools/exa/websets.ts +248 -0
- package/src/core/tools/find.ts +244 -0
- package/src/core/tools/grep.ts +584 -0
- package/src/core/tools/index.ts +283 -0
- package/src/core/tools/ls.ts +142 -0
- package/src/core/tools/lsp/client.ts +767 -0
- package/src/core/tools/lsp/clients/biome-client.ts +207 -0
- package/src/core/tools/lsp/clients/index.ts +49 -0
- package/src/core/tools/lsp/clients/lsp-linter-client.ts +98 -0
- package/src/core/tools/lsp/config.ts +845 -0
- package/src/core/tools/lsp/edits.ts +110 -0
- package/src/core/tools/lsp/index.ts +1364 -0
- package/src/core/tools/lsp/render.ts +560 -0
- package/src/core/tools/lsp/rust-analyzer.ts +145 -0
- package/src/core/tools/lsp/types.ts +495 -0
- package/src/core/tools/lsp/utils.ts +526 -0
- package/src/core/tools/notebook.ts +182 -0
- package/src/core/tools/output.ts +198 -0
- package/src/core/tools/path-utils.ts +61 -0
- package/src/core/tools/read.ts +507 -0
- package/src/core/tools/renderers.ts +820 -0
- package/src/core/tools/review.ts +275 -0
- package/src/core/tools/rulebook.ts +124 -0
- package/src/core/tools/task/agents.ts +158 -0
- package/src/core/tools/task/artifacts.ts +114 -0
- package/src/core/tools/task/commands.ts +157 -0
- package/src/core/tools/task/discovery.ts +217 -0
- package/src/core/tools/task/executor.ts +531 -0
- package/src/core/tools/task/index.ts +548 -0
- package/src/core/tools/task/model-resolver.ts +176 -0
- package/src/core/tools/task/parallel.ts +38 -0
- package/src/core/tools/task/render.ts +502 -0
- package/src/core/tools/task/subprocess-tool-registry.ts +89 -0
- package/src/core/tools/task/types.ts +142 -0
- package/src/core/tools/truncate.ts +265 -0
- package/src/core/tools/web-fetch.ts +2511 -0
- package/src/core/tools/web-search/auth.ts +199 -0
- package/src/core/tools/web-search/index.ts +583 -0
- package/src/core/tools/web-search/providers/anthropic.ts +198 -0
- package/src/core/tools/web-search/providers/exa.ts +196 -0
- package/src/core/tools/web-search/providers/perplexity.ts +195 -0
- package/src/core/tools/web-search/render.ts +372 -0
- package/src/core/tools/web-search/types.ts +180 -0
- package/src/core/tools/write.ts +63 -0
- package/src/core/ttsr.ts +211 -0
- package/src/core/utils.ts +187 -0
- package/src/discovery/agents-md.ts +75 -0
- package/src/discovery/builtin.ts +647 -0
- package/src/discovery/claude.ts +623 -0
- package/src/discovery/cline.ts +104 -0
- package/src/discovery/codex.ts +571 -0
- package/src/discovery/cursor.ts +266 -0
- package/src/discovery/gemini.ts +368 -0
- package/src/discovery/github.ts +120 -0
- package/src/discovery/helpers.test.ts +127 -0
- package/src/discovery/helpers.ts +249 -0
- package/src/discovery/index.ts +84 -0
- package/src/discovery/mcp-json.ts +127 -0
- package/src/discovery/vscode.ts +99 -0
- package/src/discovery/windsurf.ts +219 -0
- package/src/index.ts +192 -0
- package/src/main.ts +507 -0
- package/src/migrations.ts +156 -0
- package/src/modes/cleanup.ts +23 -0
- package/src/modes/index.ts +48 -0
- package/src/modes/interactive/components/armin.ts +382 -0
- package/src/modes/interactive/components/assistant-message.ts +86 -0
- package/src/modes/interactive/components/bash-execution.ts +199 -0
- package/src/modes/interactive/components/bordered-loader.ts +41 -0
- package/src/modes/interactive/components/branch-summary-message.ts +42 -0
- package/src/modes/interactive/components/compaction-summary-message.ts +45 -0
- package/src/modes/interactive/components/custom-editor.ts +122 -0
- package/src/modes/interactive/components/diff.ts +147 -0
- package/src/modes/interactive/components/dynamic-border.ts +25 -0
- package/src/modes/interactive/components/extensions/extension-dashboard.ts +296 -0
- package/src/modes/interactive/components/extensions/extension-list.ts +479 -0
- package/src/modes/interactive/components/extensions/index.ts +9 -0
- package/src/modes/interactive/components/extensions/inspector-panel.ts +313 -0
- package/src/modes/interactive/components/extensions/state-manager.ts +558 -0
- package/src/modes/interactive/components/extensions/types.ts +191 -0
- package/src/modes/interactive/components/hook-editor.ts +117 -0
- package/src/modes/interactive/components/hook-input.ts +64 -0
- package/src/modes/interactive/components/hook-message.ts +96 -0
- package/src/modes/interactive/components/hook-selector.ts +91 -0
- package/src/modes/interactive/components/model-selector.ts +560 -0
- package/src/modes/interactive/components/oauth-selector.ts +136 -0
- package/src/modes/interactive/components/plugin-settings.ts +481 -0
- package/src/modes/interactive/components/queue-mode-selector.ts +56 -0
- package/src/modes/interactive/components/session-selector.ts +220 -0
- package/src/modes/interactive/components/settings-defs.ts +597 -0
- package/src/modes/interactive/components/settings-selector.ts +545 -0
- package/src/modes/interactive/components/show-images-selector.ts +45 -0
- package/src/modes/interactive/components/status-line/index.ts +4 -0
- package/src/modes/interactive/components/status-line/presets.ts +94 -0
- package/src/modes/interactive/components/status-line/segments.ts +350 -0
- package/src/modes/interactive/components/status-line/separators.ts +55 -0
- package/src/modes/interactive/components/status-line/types.ts +81 -0
- package/src/modes/interactive/components/status-line-segment-editor.ts +357 -0
- package/src/modes/interactive/components/status-line.ts +384 -0
- package/src/modes/interactive/components/theme-selector.ts +62 -0
- package/src/modes/interactive/components/thinking-selector.ts +64 -0
- package/src/modes/interactive/components/tool-execution.ts +946 -0
- package/src/modes/interactive/components/tree-selector.ts +877 -0
- package/src/modes/interactive/components/ttsr-notification.ts +82 -0
- package/src/modes/interactive/components/user-message-selector.ts +159 -0
- package/src/modes/interactive/components/user-message.ts +18 -0
- package/src/modes/interactive/components/visual-truncate.ts +50 -0
- package/src/modes/interactive/components/welcome.ts +228 -0
- package/src/modes/interactive/interactive-mode.ts +2669 -0
- package/src/modes/interactive/theme/dark.json +102 -0
- package/src/modes/interactive/theme/defaults/dark-arctic.json +111 -0
- package/src/modes/interactive/theme/defaults/dark-catppuccin.json +106 -0
- package/src/modes/interactive/theme/defaults/dark-cyberpunk.json +109 -0
- package/src/modes/interactive/theme/defaults/dark-dracula.json +105 -0
- package/src/modes/interactive/theme/defaults/dark-forest.json +103 -0
- package/src/modes/interactive/theme/defaults/dark-github.json +112 -0
- package/src/modes/interactive/theme/defaults/dark-gruvbox.json +119 -0
- package/src/modes/interactive/theme/defaults/dark-monochrome.json +101 -0
- package/src/modes/interactive/theme/defaults/dark-monokai.json +105 -0
- package/src/modes/interactive/theme/defaults/dark-nord.json +104 -0
- package/src/modes/interactive/theme/defaults/dark-ocean.json +108 -0
- package/src/modes/interactive/theme/defaults/dark-one.json +107 -0
- package/src/modes/interactive/theme/defaults/dark-retro.json +99 -0
- package/src/modes/interactive/theme/defaults/dark-rose-pine.json +95 -0
- package/src/modes/interactive/theme/defaults/dark-solarized.json +96 -0
- package/src/modes/interactive/theme/defaults/dark-sunset.json +106 -0
- package/src/modes/interactive/theme/defaults/dark-synthwave.json +102 -0
- package/src/modes/interactive/theme/defaults/dark-tokyo-night.json +108 -0
- package/src/modes/interactive/theme/defaults/index.ts +67 -0
- package/src/modes/interactive/theme/defaults/light-arctic.json +106 -0
- package/src/modes/interactive/theme/defaults/light-catppuccin.json +105 -0
- package/src/modes/interactive/theme/defaults/light-cyberpunk.json +103 -0
- package/src/modes/interactive/theme/defaults/light-forest.json +107 -0
- package/src/modes/interactive/theme/defaults/light-github.json +114 -0
- package/src/modes/interactive/theme/defaults/light-gruvbox.json +115 -0
- package/src/modes/interactive/theme/defaults/light-monochrome.json +100 -0
- package/src/modes/interactive/theme/defaults/light-ocean.json +106 -0
- package/src/modes/interactive/theme/defaults/light-one.json +105 -0
- package/src/modes/interactive/theme/defaults/light-retro.json +105 -0
- package/src/modes/interactive/theme/defaults/light-solarized.json +101 -0
- package/src/modes/interactive/theme/defaults/light-sunset.json +106 -0
- package/src/modes/interactive/theme/defaults/light-synthwave.json +105 -0
- package/src/modes/interactive/theme/defaults/light-tokyo-night.json +118 -0
- package/src/modes/interactive/theme/light.json +99 -0
- package/src/modes/interactive/theme/theme-schema.json +424 -0
- package/src/modes/interactive/theme/theme.ts +2211 -0
- package/src/modes/print-mode.ts +163 -0
- package/src/modes/rpc/rpc-client.ts +527 -0
- package/src/modes/rpc/rpc-mode.ts +494 -0
- package/src/modes/rpc/rpc-types.ts +203 -0
- package/src/prompts/architect-plan.md +10 -0
- package/src/prompts/branch-summary-preamble.md +3 -0
- package/src/prompts/branch-summary.md +28 -0
- package/src/prompts/browser.md +71 -0
- package/src/prompts/compaction-summary.md +34 -0
- package/src/prompts/compaction-turn-prefix.md +16 -0
- package/src/prompts/compaction-update-summary.md +41 -0
- package/src/prompts/explore.md +82 -0
- package/src/prompts/implement-with-critic.md +11 -0
- package/src/prompts/implement.md +11 -0
- package/src/prompts/init.md +30 -0
- package/src/prompts/plan.md +54 -0
- package/src/prompts/reviewer.md +81 -0
- package/src/prompts/summarization-system.md +3 -0
- package/src/prompts/system-prompt.md +27 -0
- package/src/prompts/task.md +56 -0
- package/src/prompts/title-system.md +8 -0
- package/src/prompts/tools/ask.md +24 -0
- package/src/prompts/tools/bash.md +23 -0
- package/src/prompts/tools/edit.md +9 -0
- package/src/prompts/tools/find.md +6 -0
- package/src/prompts/tools/grep.md +12 -0
- package/src/prompts/tools/lsp.md +14 -0
- package/src/prompts/tools/output.md +23 -0
- package/src/prompts/tools/read.md +25 -0
- package/src/prompts/tools/web-fetch.md +8 -0
- package/src/prompts/tools/web-search.md +10 -0
- package/src/prompts/tools/write.md +10 -0
- package/src/utils/changelog.ts +99 -0
- package/src/utils/clipboard.ts +265 -0
- package/src/utils/fuzzy.ts +108 -0
- package/src/utils/mime.ts +30 -0
- package/src/utils/shell-snapshot.ts +218 -0
- package/src/utils/shell.ts +364 -0
- package/src/utils/tools-manager.ts +265 -0
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { extname, join } from "node:path";
|
|
4
|
+
import { getConfigDirPaths } from "../../../config.js";
|
|
5
|
+
import { createBiomeClient } from "./clients/biome-client";
|
|
6
|
+
import type { ServerConfig } from "./types";
|
|
7
|
+
|
|
8
|
+
export interface LspConfig {
|
|
9
|
+
servers: Record<string, ServerConfig>;
|
|
10
|
+
/** Idle timeout in milliseconds. If set, LSP clients will be shutdown after this period of inactivity. Disabled by default. */
|
|
11
|
+
idleTimeoutMs?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// Predefined Server Configurations
|
|
16
|
+
// =============================================================================
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Comprehensive LSP server configurations.
|
|
20
|
+
*
|
|
21
|
+
* Each server can be customized via lsp.json config file with these options:
|
|
22
|
+
* - command: Binary name or path
|
|
23
|
+
* - args: Command line arguments
|
|
24
|
+
* - fileTypes: File extensions this server handles
|
|
25
|
+
* - rootMarkers: Files that indicate project root
|
|
26
|
+
* - initOptions: LSP initialization options
|
|
27
|
+
* - settings: LSP workspace settings
|
|
28
|
+
* - disabled: Set to true to disable this server
|
|
29
|
+
* - isLinter: If true, used only for diagnostics/actions (not type intelligence)
|
|
30
|
+
*/
|
|
31
|
+
export const SERVERS: Record<string, ServerConfig> = {
|
|
32
|
+
// =========================================================================
|
|
33
|
+
// Systems Languages
|
|
34
|
+
// =========================================================================
|
|
35
|
+
|
|
36
|
+
"rust-analyzer": {
|
|
37
|
+
command: "rust-analyzer",
|
|
38
|
+
args: [],
|
|
39
|
+
fileTypes: [".rs"],
|
|
40
|
+
rootMarkers: ["Cargo.toml", "rust-analyzer.toml"],
|
|
41
|
+
initOptions: {
|
|
42
|
+
checkOnSave: { command: "clippy" },
|
|
43
|
+
cargo: { allFeatures: true },
|
|
44
|
+
procMacro: { enable: true },
|
|
45
|
+
},
|
|
46
|
+
settings: {
|
|
47
|
+
"rust-analyzer": {
|
|
48
|
+
diagnostics: { enable: true },
|
|
49
|
+
inlayHints: { enable: true },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
capabilities: {
|
|
53
|
+
flycheck: true,
|
|
54
|
+
ssr: true,
|
|
55
|
+
expandMacro: true,
|
|
56
|
+
runnables: true,
|
|
57
|
+
relatedTests: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
clangd: {
|
|
62
|
+
command: "clangd",
|
|
63
|
+
args: ["--background-index", "--clang-tidy", "--header-insertion=iwyu"],
|
|
64
|
+
fileTypes: [".c", ".cpp", ".cc", ".cxx", ".h", ".hpp", ".hxx", ".m", ".mm"],
|
|
65
|
+
rootMarkers: ["compile_commands.json", "CMakeLists.txt", ".clangd", ".clang-format", "Makefile"],
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
zls: {
|
|
69
|
+
command: "zls",
|
|
70
|
+
args: [],
|
|
71
|
+
fileTypes: [".zig"],
|
|
72
|
+
rootMarkers: ["build.zig", "build.zig.zon", "zls.json"],
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
gopls: {
|
|
76
|
+
command: "gopls",
|
|
77
|
+
args: ["serve"],
|
|
78
|
+
fileTypes: [".go", ".mod", ".sum"],
|
|
79
|
+
rootMarkers: ["go.mod", "go.work", "go.sum"],
|
|
80
|
+
settings: {
|
|
81
|
+
gopls: {
|
|
82
|
+
analyses: { unusedparams: true, shadow: true },
|
|
83
|
+
staticcheck: true,
|
|
84
|
+
gofumpt: true,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// =========================================================================
|
|
90
|
+
// JavaScript/TypeScript Ecosystem
|
|
91
|
+
// =========================================================================
|
|
92
|
+
|
|
93
|
+
"typescript-language-server": {
|
|
94
|
+
command: "typescript-language-server",
|
|
95
|
+
args: ["--stdio"],
|
|
96
|
+
fileTypes: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"],
|
|
97
|
+
rootMarkers: ["package.json", "tsconfig.json", "jsconfig.json"],
|
|
98
|
+
initOptions: {
|
|
99
|
+
hostInfo: "omp-coding-agent",
|
|
100
|
+
preferences: {
|
|
101
|
+
includeInlayParameterNameHints: "all",
|
|
102
|
+
includeInlayVariableTypeHints: true,
|
|
103
|
+
includeInlayFunctionParameterTypeHints: true,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
biome: {
|
|
109
|
+
command: "biome",
|
|
110
|
+
args: ["lsp-proxy"],
|
|
111
|
+
fileTypes: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json", ".jsonc"],
|
|
112
|
+
rootMarkers: ["biome.json", "biome.jsonc"],
|
|
113
|
+
isLinter: true,
|
|
114
|
+
// Use CLI instead of LSP - Biome's LSP has known stale diagnostics issues
|
|
115
|
+
createClient: createBiomeClient,
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
eslint: {
|
|
119
|
+
command: "vscode-eslint-language-server",
|
|
120
|
+
args: ["--stdio"],
|
|
121
|
+
fileTypes: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".vue", ".svelte"],
|
|
122
|
+
rootMarkers: [
|
|
123
|
+
".eslintrc",
|
|
124
|
+
".eslintrc.js",
|
|
125
|
+
".eslintrc.json",
|
|
126
|
+
".eslintrc.yml",
|
|
127
|
+
"eslint.config.js",
|
|
128
|
+
"eslint.config.mjs",
|
|
129
|
+
],
|
|
130
|
+
isLinter: true,
|
|
131
|
+
settings: {
|
|
132
|
+
validate: "on",
|
|
133
|
+
run: "onType",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
denols: {
|
|
138
|
+
command: "deno",
|
|
139
|
+
args: ["lsp"],
|
|
140
|
+
fileTypes: [".ts", ".tsx", ".js", ".jsx"],
|
|
141
|
+
rootMarkers: ["deno.json", "deno.jsonc", "deno.lock"],
|
|
142
|
+
initOptions: {
|
|
143
|
+
enable: true,
|
|
144
|
+
lint: true,
|
|
145
|
+
unstable: true,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
// =========================================================================
|
|
150
|
+
// Web Technologies
|
|
151
|
+
// =========================================================================
|
|
152
|
+
|
|
153
|
+
"vscode-html-language-server": {
|
|
154
|
+
command: "vscode-html-language-server",
|
|
155
|
+
args: ["--stdio"],
|
|
156
|
+
fileTypes: [".html", ".htm"],
|
|
157
|
+
rootMarkers: ["package.json", ".git"],
|
|
158
|
+
initOptions: {
|
|
159
|
+
provideFormatter: true,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
"vscode-css-language-server": {
|
|
164
|
+
command: "vscode-css-language-server",
|
|
165
|
+
args: ["--stdio"],
|
|
166
|
+
fileTypes: [".css", ".scss", ".sass", ".less"],
|
|
167
|
+
rootMarkers: ["package.json", ".git"],
|
|
168
|
+
initOptions: {
|
|
169
|
+
provideFormatter: true,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
"vscode-json-language-server": {
|
|
174
|
+
command: "vscode-json-language-server",
|
|
175
|
+
args: ["--stdio"],
|
|
176
|
+
fileTypes: [".json", ".jsonc"],
|
|
177
|
+
rootMarkers: ["package.json", ".git"],
|
|
178
|
+
initOptions: {
|
|
179
|
+
provideFormatter: true,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
tailwindcss: {
|
|
184
|
+
command: "tailwindcss-language-server",
|
|
185
|
+
args: ["--stdio"],
|
|
186
|
+
fileTypes: [".html", ".css", ".scss", ".js", ".jsx", ".ts", ".tsx", ".vue", ".svelte"],
|
|
187
|
+
rootMarkers: ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"],
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
svelte: {
|
|
191
|
+
command: "svelteserver",
|
|
192
|
+
args: ["--stdio"],
|
|
193
|
+
fileTypes: [".svelte"],
|
|
194
|
+
rootMarkers: ["svelte.config.js", "svelte.config.mjs", "package.json"],
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
"vue-language-server": {
|
|
198
|
+
command: "vue-language-server",
|
|
199
|
+
args: ["--stdio"],
|
|
200
|
+
fileTypes: [".vue"],
|
|
201
|
+
rootMarkers: ["vue.config.js", "nuxt.config.js", "nuxt.config.ts", "package.json"],
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
astro: {
|
|
205
|
+
command: "astro-ls",
|
|
206
|
+
args: ["--stdio"],
|
|
207
|
+
fileTypes: [".astro"],
|
|
208
|
+
rootMarkers: ["astro.config.mjs", "astro.config.js", "astro.config.ts"],
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
// =========================================================================
|
|
212
|
+
// Python
|
|
213
|
+
// =========================================================================
|
|
214
|
+
|
|
215
|
+
pyright: {
|
|
216
|
+
command: "pyright-langserver",
|
|
217
|
+
args: ["--stdio"],
|
|
218
|
+
fileTypes: [".py", ".pyi"],
|
|
219
|
+
rootMarkers: ["pyproject.toml", "pyrightconfig.json", "setup.py", "setup.cfg", "requirements.txt", "Pipfile"],
|
|
220
|
+
settings: {
|
|
221
|
+
python: {
|
|
222
|
+
analysis: {
|
|
223
|
+
autoSearchPaths: true,
|
|
224
|
+
diagnosticMode: "openFilesOnly",
|
|
225
|
+
useLibraryCodeForTypes: true,
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
basedpyright: {
|
|
232
|
+
command: "basedpyright-langserver",
|
|
233
|
+
args: ["--stdio"],
|
|
234
|
+
fileTypes: [".py", ".pyi"],
|
|
235
|
+
rootMarkers: ["pyproject.toml", "pyrightconfig.json", "setup.py", "requirements.txt"],
|
|
236
|
+
settings: {
|
|
237
|
+
basedpyright: {
|
|
238
|
+
analysis: {
|
|
239
|
+
autoSearchPaths: true,
|
|
240
|
+
diagnosticMode: "openFilesOnly",
|
|
241
|
+
useLibraryCodeForTypes: true,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
pylsp: {
|
|
248
|
+
command: "pylsp",
|
|
249
|
+
args: [],
|
|
250
|
+
fileTypes: [".py"],
|
|
251
|
+
rootMarkers: ["pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile"],
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
ruff: {
|
|
255
|
+
command: "ruff",
|
|
256
|
+
args: ["server"],
|
|
257
|
+
fileTypes: [".py", ".pyi"],
|
|
258
|
+
rootMarkers: ["pyproject.toml", "ruff.toml", ".ruff.toml"],
|
|
259
|
+
isLinter: true,
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// =========================================================================
|
|
263
|
+
// JVM Languages
|
|
264
|
+
// =========================================================================
|
|
265
|
+
|
|
266
|
+
jdtls: {
|
|
267
|
+
command: "jdtls",
|
|
268
|
+
args: [],
|
|
269
|
+
fileTypes: [".java"],
|
|
270
|
+
rootMarkers: ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", ".project"],
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
"kotlin-language-server": {
|
|
274
|
+
command: "kotlin-language-server",
|
|
275
|
+
args: [],
|
|
276
|
+
fileTypes: [".kt", ".kts"],
|
|
277
|
+
rootMarkers: ["build.gradle", "build.gradle.kts", "pom.xml", "settings.gradle", "settings.gradle.kts"],
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
metals: {
|
|
281
|
+
command: "metals",
|
|
282
|
+
args: [],
|
|
283
|
+
fileTypes: [".scala", ".sbt", ".sc"],
|
|
284
|
+
rootMarkers: ["build.sbt", "build.sc", "build.gradle", "pom.xml"],
|
|
285
|
+
initOptions: {
|
|
286
|
+
statusBarProvider: "show-message",
|
|
287
|
+
isHttpEnabled: true,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
// =========================================================================
|
|
292
|
+
// Functional Languages
|
|
293
|
+
// =========================================================================
|
|
294
|
+
|
|
295
|
+
hls: {
|
|
296
|
+
command: "haskell-language-server-wrapper",
|
|
297
|
+
args: ["--lsp"],
|
|
298
|
+
fileTypes: [".hs", ".lhs"],
|
|
299
|
+
rootMarkers: ["stack.yaml", "cabal.project", "hie.yaml", "package.yaml", "*.cabal"],
|
|
300
|
+
settings: {
|
|
301
|
+
haskell: {
|
|
302
|
+
formattingProvider: "ormolu",
|
|
303
|
+
checkProject: true,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
ocamllsp: {
|
|
309
|
+
command: "ocamllsp",
|
|
310
|
+
args: [],
|
|
311
|
+
fileTypes: [".ml", ".mli", ".mll", ".mly"],
|
|
312
|
+
rootMarkers: ["dune-project", "dune-workspace", "*.opam", ".ocamlformat"],
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
elixirls: {
|
|
316
|
+
command: "elixir-ls",
|
|
317
|
+
args: [],
|
|
318
|
+
fileTypes: [".ex", ".exs", ".heex", ".eex"],
|
|
319
|
+
rootMarkers: ["mix.exs", "mix.lock"],
|
|
320
|
+
settings: {
|
|
321
|
+
elixirLS: {
|
|
322
|
+
dialyzerEnabled: true,
|
|
323
|
+
fetchDeps: false,
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
erlangls: {
|
|
329
|
+
command: "erlang_ls",
|
|
330
|
+
args: [],
|
|
331
|
+
fileTypes: [".erl", ".hrl"],
|
|
332
|
+
rootMarkers: ["rebar.config", "erlang.mk", "rebar.lock"],
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
gleam: {
|
|
336
|
+
command: "gleam",
|
|
337
|
+
args: ["lsp"],
|
|
338
|
+
fileTypes: [".gleam"],
|
|
339
|
+
rootMarkers: ["gleam.toml"],
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
// =========================================================================
|
|
343
|
+
// Ruby
|
|
344
|
+
// =========================================================================
|
|
345
|
+
|
|
346
|
+
solargraph: {
|
|
347
|
+
command: "solargraph",
|
|
348
|
+
args: ["stdio"],
|
|
349
|
+
fileTypes: [".rb", ".rake", ".gemspec"],
|
|
350
|
+
rootMarkers: ["Gemfile", ".solargraph.yml", "Rakefile"],
|
|
351
|
+
initOptions: {
|
|
352
|
+
formatting: true,
|
|
353
|
+
},
|
|
354
|
+
settings: {
|
|
355
|
+
solargraph: {
|
|
356
|
+
diagnostics: true,
|
|
357
|
+
completion: true,
|
|
358
|
+
hover: true,
|
|
359
|
+
formatting: true,
|
|
360
|
+
references: true,
|
|
361
|
+
rename: true,
|
|
362
|
+
symbols: true,
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
"ruby-lsp": {
|
|
368
|
+
command: "ruby-lsp",
|
|
369
|
+
args: [],
|
|
370
|
+
fileTypes: [".rb", ".rake", ".gemspec", ".erb"],
|
|
371
|
+
rootMarkers: ["Gemfile", ".ruby-version", ".ruby-gemset"],
|
|
372
|
+
initOptions: {
|
|
373
|
+
formatter: "auto",
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
rubocop: {
|
|
378
|
+
command: "rubocop",
|
|
379
|
+
args: ["--lsp"],
|
|
380
|
+
fileTypes: [".rb", ".rake"],
|
|
381
|
+
rootMarkers: [".rubocop.yml", "Gemfile"],
|
|
382
|
+
isLinter: true,
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
// =========================================================================
|
|
386
|
+
// Shell / Scripting
|
|
387
|
+
// =========================================================================
|
|
388
|
+
|
|
389
|
+
bashls: {
|
|
390
|
+
command: "bash-language-server",
|
|
391
|
+
args: ["start"],
|
|
392
|
+
fileTypes: [".sh", ".bash", ".zsh"],
|
|
393
|
+
rootMarkers: [".git"],
|
|
394
|
+
settings: {
|
|
395
|
+
bashIde: {
|
|
396
|
+
globPattern: "*@(.sh|.inc|.bash|.command)",
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
nushell: {
|
|
402
|
+
command: "nu",
|
|
403
|
+
args: ["--lsp"],
|
|
404
|
+
fileTypes: [".nu"],
|
|
405
|
+
rootMarkers: [".git"],
|
|
406
|
+
},
|
|
407
|
+
|
|
408
|
+
// =========================================================================
|
|
409
|
+
// Lua
|
|
410
|
+
// =========================================================================
|
|
411
|
+
|
|
412
|
+
"lua-language-server": {
|
|
413
|
+
command: "lua-language-server",
|
|
414
|
+
args: [],
|
|
415
|
+
fileTypes: [".lua"],
|
|
416
|
+
rootMarkers: [".luarc.json", ".luarc.jsonc", ".luacheckrc", ".stylua.toml", "stylua.toml"],
|
|
417
|
+
settings: {
|
|
418
|
+
Lua: {
|
|
419
|
+
runtime: { version: "LuaJIT" },
|
|
420
|
+
diagnostics: { globals: ["vim"] },
|
|
421
|
+
workspace: { checkThirdParty: false },
|
|
422
|
+
telemetry: { enable: false },
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
|
|
427
|
+
// =========================================================================
|
|
428
|
+
// PHP
|
|
429
|
+
// =========================================================================
|
|
430
|
+
|
|
431
|
+
intelephense: {
|
|
432
|
+
command: "intelephense",
|
|
433
|
+
args: ["--stdio"],
|
|
434
|
+
fileTypes: [".php", ".phtml"],
|
|
435
|
+
rootMarkers: ["composer.json", "composer.lock", ".git"],
|
|
436
|
+
},
|
|
437
|
+
|
|
438
|
+
phpactor: {
|
|
439
|
+
command: "phpactor",
|
|
440
|
+
args: ["language-server"],
|
|
441
|
+
fileTypes: [".php"],
|
|
442
|
+
rootMarkers: ["composer.json", ".phpactor.json", ".phpactor.yml"],
|
|
443
|
+
},
|
|
444
|
+
|
|
445
|
+
// =========================================================================
|
|
446
|
+
// .NET
|
|
447
|
+
// =========================================================================
|
|
448
|
+
|
|
449
|
+
omnisharp: {
|
|
450
|
+
command: "omnisharp",
|
|
451
|
+
args: ["-z", "--hostPID", String(process.pid), "--encoding", "utf-8", "--languageserver"],
|
|
452
|
+
fileTypes: [".cs", ".csx"],
|
|
453
|
+
rootMarkers: ["*.sln", "*.csproj", "omnisharp.json", ".git"],
|
|
454
|
+
settings: {
|
|
455
|
+
FormattingOptions: { EnableEditorConfigSupport: true },
|
|
456
|
+
RoslynExtensionsOptions: { EnableAnalyzersSupport: true },
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
|
|
460
|
+
// =========================================================================
|
|
461
|
+
// Configuration Languages
|
|
462
|
+
// =========================================================================
|
|
463
|
+
|
|
464
|
+
yamlls: {
|
|
465
|
+
command: "yaml-language-server",
|
|
466
|
+
args: ["--stdio"],
|
|
467
|
+
fileTypes: [".yaml", ".yml"],
|
|
468
|
+
rootMarkers: [".git"],
|
|
469
|
+
settings: {
|
|
470
|
+
yaml: {
|
|
471
|
+
validate: true,
|
|
472
|
+
format: { enable: true },
|
|
473
|
+
hover: true,
|
|
474
|
+
completion: true,
|
|
475
|
+
},
|
|
476
|
+
redhat: { telemetry: { enabled: false } },
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
taplo: {
|
|
481
|
+
command: "taplo",
|
|
482
|
+
args: ["lsp", "stdio"],
|
|
483
|
+
fileTypes: [".toml"],
|
|
484
|
+
rootMarkers: [".taplo.toml", "taplo.toml", ".git"],
|
|
485
|
+
},
|
|
486
|
+
|
|
487
|
+
terraformls: {
|
|
488
|
+
command: "terraform-ls",
|
|
489
|
+
args: ["serve"],
|
|
490
|
+
fileTypes: [".tf", ".tfvars"],
|
|
491
|
+
rootMarkers: [".terraform", "terraform.tfstate", "*.tf"],
|
|
492
|
+
},
|
|
493
|
+
|
|
494
|
+
dockerls: {
|
|
495
|
+
command: "docker-langserver",
|
|
496
|
+
args: ["--stdio"],
|
|
497
|
+
fileTypes: [".dockerfile"],
|
|
498
|
+
rootMarkers: ["Dockerfile", "docker-compose.yml", "docker-compose.yaml", ".dockerignore"],
|
|
499
|
+
},
|
|
500
|
+
|
|
501
|
+
"helm-ls": {
|
|
502
|
+
command: "helm_ls",
|
|
503
|
+
args: ["serve"],
|
|
504
|
+
fileTypes: [".yaml", ".yml", ".tpl"],
|
|
505
|
+
rootMarkers: ["Chart.yaml", "Chart.yml"],
|
|
506
|
+
},
|
|
507
|
+
|
|
508
|
+
// =========================================================================
|
|
509
|
+
// Nix
|
|
510
|
+
// =========================================================================
|
|
511
|
+
|
|
512
|
+
nixd: {
|
|
513
|
+
command: "nixd",
|
|
514
|
+
args: [],
|
|
515
|
+
fileTypes: [".nix"],
|
|
516
|
+
rootMarkers: ["flake.nix", "default.nix", "shell.nix"],
|
|
517
|
+
},
|
|
518
|
+
|
|
519
|
+
nil: {
|
|
520
|
+
command: "nil",
|
|
521
|
+
args: [],
|
|
522
|
+
fileTypes: [".nix"],
|
|
523
|
+
rootMarkers: ["flake.nix", "default.nix", "shell.nix"],
|
|
524
|
+
},
|
|
525
|
+
|
|
526
|
+
// =========================================================================
|
|
527
|
+
// Other Languages
|
|
528
|
+
// =========================================================================
|
|
529
|
+
|
|
530
|
+
ols: {
|
|
531
|
+
command: "ols",
|
|
532
|
+
args: [],
|
|
533
|
+
fileTypes: [".odin"],
|
|
534
|
+
rootMarkers: ["ols.json", ".git"],
|
|
535
|
+
},
|
|
536
|
+
|
|
537
|
+
dartls: {
|
|
538
|
+
command: "dart",
|
|
539
|
+
args: ["language-server", "--protocol=lsp"],
|
|
540
|
+
fileTypes: [".dart"],
|
|
541
|
+
rootMarkers: ["pubspec.yaml", "pubspec.lock"],
|
|
542
|
+
initOptions: {
|
|
543
|
+
closingLabels: true,
|
|
544
|
+
flutterOutline: true,
|
|
545
|
+
outline: true,
|
|
546
|
+
},
|
|
547
|
+
},
|
|
548
|
+
|
|
549
|
+
marksman: {
|
|
550
|
+
command: "marksman",
|
|
551
|
+
args: ["server"],
|
|
552
|
+
fileTypes: [".md", ".markdown"],
|
|
553
|
+
rootMarkers: [".marksman.toml", ".git"],
|
|
554
|
+
},
|
|
555
|
+
|
|
556
|
+
texlab: {
|
|
557
|
+
command: "texlab",
|
|
558
|
+
args: [],
|
|
559
|
+
fileTypes: [".tex", ".bib", ".sty", ".cls"],
|
|
560
|
+
rootMarkers: [".latexmkrc", "latexmkrc", ".texlabroot", "texlabroot", "Tectonic.toml"],
|
|
561
|
+
settings: {
|
|
562
|
+
texlab: {
|
|
563
|
+
build: {
|
|
564
|
+
executable: "latexmk",
|
|
565
|
+
args: ["-pdf", "-interaction=nonstopmode", "-synctex=1", "%f"],
|
|
566
|
+
},
|
|
567
|
+
chktex: { onOpenAndSave: true },
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
|
|
572
|
+
graphql: {
|
|
573
|
+
command: "graphql-lsp",
|
|
574
|
+
args: ["server", "-m", "stream"],
|
|
575
|
+
fileTypes: [".graphql", ".gql"],
|
|
576
|
+
rootMarkers: [".graphqlrc", ".graphqlrc.json", ".graphqlrc.yml", ".graphqlrc.yaml", "graphql.config.js"],
|
|
577
|
+
},
|
|
578
|
+
|
|
579
|
+
prismals: {
|
|
580
|
+
command: "prisma-language-server",
|
|
581
|
+
args: ["--stdio"],
|
|
582
|
+
fileTypes: [".prisma"],
|
|
583
|
+
rootMarkers: ["schema.prisma", "prisma/schema.prisma"],
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
vimls: {
|
|
587
|
+
command: "vim-language-server",
|
|
588
|
+
args: ["--stdio"],
|
|
589
|
+
fileTypes: [".vim", ".vimrc"],
|
|
590
|
+
rootMarkers: [".git"],
|
|
591
|
+
initOptions: {
|
|
592
|
+
isNeovim: true,
|
|
593
|
+
diagnostic: { enable: true },
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
|
|
597
|
+
// =========================================================================
|
|
598
|
+
// Emmet (HTML/CSS expansion)
|
|
599
|
+
// =========================================================================
|
|
600
|
+
|
|
601
|
+
"emmet-language-server": {
|
|
602
|
+
command: "emmet-language-server",
|
|
603
|
+
args: ["--stdio"],
|
|
604
|
+
fileTypes: [".html", ".css", ".scss", ".less", ".jsx", ".tsx", ".vue", ".svelte"],
|
|
605
|
+
rootMarkers: [".git"],
|
|
606
|
+
},
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
// =============================================================================
|
|
610
|
+
// Configuration Loading
|
|
611
|
+
// =============================================================================
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Check if any root marker file exists in the directory
|
|
615
|
+
*/
|
|
616
|
+
export function hasRootMarkers(cwd: string, markers: string[]): boolean {
|
|
617
|
+
return markers.some((marker) => {
|
|
618
|
+
// Handle glob-like patterns (e.g., "*.cabal")
|
|
619
|
+
if (marker.includes("*")) {
|
|
620
|
+
try {
|
|
621
|
+
const { globSync } = require("node:fs");
|
|
622
|
+
const matches = globSync(join(cwd, marker));
|
|
623
|
+
return matches.length > 0;
|
|
624
|
+
} catch {
|
|
625
|
+
// globSync not available, skip glob patterns
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return existsSync(join(cwd, marker));
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
// =============================================================================
|
|
634
|
+
// Local Binary Resolution
|
|
635
|
+
// =============================================================================
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Local bin directories to check before $PATH, ordered by priority.
|
|
639
|
+
* Each entry maps a root marker to the bin directory to check.
|
|
640
|
+
*/
|
|
641
|
+
const LOCAL_BIN_PATHS: Array<{ markers: string[]; binDir: string }> = [
|
|
642
|
+
// Node.js - check node_modules/.bin/
|
|
643
|
+
{ markers: ["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"], binDir: "node_modules/.bin" },
|
|
644
|
+
// Python - check virtual environment bin directories
|
|
645
|
+
{ markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: ".venv/bin" },
|
|
646
|
+
{ markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: "venv/bin" },
|
|
647
|
+
{ markers: ["pyproject.toml", "requirements.txt", "setup.py", "Pipfile"], binDir: ".env/bin" },
|
|
648
|
+
// Ruby - check vendor bundle and binstubs
|
|
649
|
+
{ markers: ["Gemfile", "Gemfile.lock"], binDir: "vendor/bundle/bin" },
|
|
650
|
+
{ markers: ["Gemfile", "Gemfile.lock"], binDir: "bin" },
|
|
651
|
+
// Go - check project-local bin
|
|
652
|
+
{ markers: ["go.mod", "go.sum"], binDir: "bin" },
|
|
653
|
+
];
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Resolve a command to an executable path.
|
|
657
|
+
* Checks project-local bin directories first, then falls back to $PATH.
|
|
658
|
+
*
|
|
659
|
+
* @param command - The command name (e.g., "typescript-language-server")
|
|
660
|
+
* @param cwd - Working directory to search from
|
|
661
|
+
* @returns Absolute path to the executable, or null if not found
|
|
662
|
+
*/
|
|
663
|
+
export function resolveCommand(command: string, cwd: string): string | null {
|
|
664
|
+
// Check local bin directories based on project markers
|
|
665
|
+
for (const { markers, binDir } of LOCAL_BIN_PATHS) {
|
|
666
|
+
if (hasRootMarkers(cwd, markers)) {
|
|
667
|
+
const localPath = join(cwd, binDir, command);
|
|
668
|
+
if (existsSync(localPath)) {
|
|
669
|
+
return localPath;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// Fall back to $PATH
|
|
675
|
+
return Bun.which(command);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Configuration file search paths (in priority order).
|
|
680
|
+
* Supports both visible and hidden variants at each config location.
|
|
681
|
+
*/
|
|
682
|
+
function getConfigPaths(cwd: string): string[] {
|
|
683
|
+
const filenames = ["lsp.json", ".lsp.json"];
|
|
684
|
+
const paths: string[] = [];
|
|
685
|
+
|
|
686
|
+
// Project root files (highest priority)
|
|
687
|
+
for (const filename of filenames) {
|
|
688
|
+
paths.push(join(cwd, filename));
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// Project config directories (.omp/, .pi/, .claude/)
|
|
692
|
+
const projectDirs = getConfigDirPaths("", { user: false, project: true, cwd });
|
|
693
|
+
for (const dir of projectDirs) {
|
|
694
|
+
for (const filename of filenames) {
|
|
695
|
+
paths.push(join(dir, filename));
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// User config directories (~/.omp/agent/, ~/.pi/agent/, ~/.claude/)
|
|
700
|
+
const userDirs = getConfigDirPaths("", { user: true, project: false });
|
|
701
|
+
for (const dir of userDirs) {
|
|
702
|
+
for (const filename of filenames) {
|
|
703
|
+
paths.push(join(dir, filename));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// User home root files (lowest priority fallback)
|
|
708
|
+
for (const filename of filenames) {
|
|
709
|
+
paths.push(join(homedir(), filename));
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return paths;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Load LSP configuration.
|
|
717
|
+
*
|
|
718
|
+
* Priority:
|
|
719
|
+
* 1. Project root: lsp.json, .lsp.json
|
|
720
|
+
* 2. Project config dirs: .omp/lsp.json, .pi/lsp.json, .claude/lsp.json (+ hidden variants)
|
|
721
|
+
* 3. User config dirs: ~/.omp/agent/lsp.json, ~/.pi/agent/lsp.json, ~/.claude/lsp.json (+ hidden variants)
|
|
722
|
+
* 4. User home root: ~/lsp.json, ~/.lsp.json
|
|
723
|
+
* 5. Auto-detect from project markers + available binaries
|
|
724
|
+
*
|
|
725
|
+
* Config file format:
|
|
726
|
+
* ```json
|
|
727
|
+
* {
|
|
728
|
+
* "servers": {
|
|
729
|
+
* "typescript-language-server": {
|
|
730
|
+
* "command": "typescript-language-server",
|
|
731
|
+
* "args": ["--stdio", "--log-level", "4"],
|
|
732
|
+
* "disabled": false
|
|
733
|
+
* },
|
|
734
|
+
* "my-custom-server": {
|
|
735
|
+
* "command": "/path/to/server",
|
|
736
|
+
* "args": ["--stdio"],
|
|
737
|
+
* "fileTypes": [".xyz"],
|
|
738
|
+
* "rootMarkers": [".xyz-project"]
|
|
739
|
+
* }
|
|
740
|
+
* }
|
|
741
|
+
* }
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
export function loadConfig(cwd: string): LspConfig {
|
|
745
|
+
const configPaths = getConfigPaths(cwd);
|
|
746
|
+
|
|
747
|
+
for (const configPath of configPaths) {
|
|
748
|
+
if (existsSync(configPath)) {
|
|
749
|
+
try {
|
|
750
|
+
const content = readFileSync(configPath, "utf-8");
|
|
751
|
+
const parsed = JSON.parse(content);
|
|
752
|
+
|
|
753
|
+
// Support both { servers: {...} } and direct server map
|
|
754
|
+
const servers = parsed.servers || parsed;
|
|
755
|
+
|
|
756
|
+
// Merge with defaults and filter to available
|
|
757
|
+
const merged: Record<string, ServerConfig> = { ...SERVERS };
|
|
758
|
+
|
|
759
|
+
for (const [name, config] of Object.entries(servers) as [string, Partial<ServerConfig>][]) {
|
|
760
|
+
if (merged[name]) {
|
|
761
|
+
// Merge with existing config
|
|
762
|
+
merged[name] = { ...merged[name], ...config };
|
|
763
|
+
} else {
|
|
764
|
+
// Add new server config
|
|
765
|
+
merged[name] = config as ServerConfig;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// Filter to only enabled servers with available commands
|
|
770
|
+
const available: Record<string, ServerConfig> = {};
|
|
771
|
+
for (const [name, config] of Object.entries(merged)) {
|
|
772
|
+
if (config.disabled) continue;
|
|
773
|
+
const resolved = resolveCommand(config.command, cwd);
|
|
774
|
+
if (!resolved) continue;
|
|
775
|
+
available[name] = { ...config, resolvedCommand: resolved };
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return { servers: available };
|
|
779
|
+
} catch {
|
|
780
|
+
// Ignore parse errors, continue to next config or auto-detect
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// Auto-detect: find servers based on project markers AND available binaries
|
|
786
|
+
const detected: Record<string, ServerConfig> = {};
|
|
787
|
+
|
|
788
|
+
for (const [name, config] of Object.entries(SERVERS)) {
|
|
789
|
+
// Check if project has root markers for this language
|
|
790
|
+
if (!hasRootMarkers(cwd, config.rootMarkers)) continue;
|
|
791
|
+
|
|
792
|
+
// Check if the language server binary is available (local or $PATH)
|
|
793
|
+
const resolved = resolveCommand(config.command, cwd);
|
|
794
|
+
if (!resolved) continue;
|
|
795
|
+
|
|
796
|
+
detected[name] = { ...config, resolvedCommand: resolved };
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
return { servers: detected };
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// =============================================================================
|
|
803
|
+
// Server Selection
|
|
804
|
+
// =============================================================================
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Find all servers that can handle a file based on extension.
|
|
808
|
+
* Returns servers sorted with primary (non-linter) servers first.
|
|
809
|
+
*/
|
|
810
|
+
export function getServersForFile(config: LspConfig, filePath: string): Array<[string, ServerConfig]> {
|
|
811
|
+
const ext = extname(filePath).toLowerCase();
|
|
812
|
+
const matches: Array<[string, ServerConfig]> = [];
|
|
813
|
+
|
|
814
|
+
for (const [name, serverConfig] of Object.entries(config.servers)) {
|
|
815
|
+
if (serverConfig.fileTypes.includes(ext)) {
|
|
816
|
+
matches.push([name, serverConfig]);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// Sort: primary servers (non-linters) first, then linters
|
|
821
|
+
return matches.sort((a, b) => {
|
|
822
|
+
const aIsLinter = a[1].isLinter ? 1 : 0;
|
|
823
|
+
const bIsLinter = b[1].isLinter ? 1 : 0;
|
|
824
|
+
return aIsLinter - bIsLinter;
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Find the primary server for a file (prefers type-checkers over linters).
|
|
830
|
+
* Used for operations like definition, hover, references that need type intelligence.
|
|
831
|
+
*/
|
|
832
|
+
export function getServerForFile(config: LspConfig, filePath: string): [string, ServerConfig] | null {
|
|
833
|
+
const servers = getServersForFile(config, filePath);
|
|
834
|
+
return servers.length > 0 ? servers[0] : null;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Check if a server has a specific capability
|
|
839
|
+
*/
|
|
840
|
+
export function hasCapability(
|
|
841
|
+
config: ServerConfig,
|
|
842
|
+
capability: keyof NonNullable<ServerConfig["capabilities"]>,
|
|
843
|
+
): boolean {
|
|
844
|
+
return config.capabilities?.[capability] === true;
|
|
845
|
+
}
|