@mrclrchtr/supi-lsp 7.4.0 → 8.0.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/README.md +29 -6
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
- package/package.json +3 -3
- package/src/api.ts +25 -3
- package/src/client/client-diagnostic-host.ts +2 -1
- package/src/client/client-diagnostic-refresh.ts +5 -2
- package/src/client/client-diagnostics.ts +39 -6
- package/src/client/client-document-sync.ts +82 -12
- package/src/client/client-semantic-input-barrier.ts +28 -5
- package/src/client/client.ts +606 -30
- package/src/config/capabilities.ts +9 -0
- package/src/config/config.ts +69 -8
- package/src/config/operation-support.ts +196 -0
- package/src/config/server-config.ts +15 -0
- package/src/config/types.ts +9 -1
- package/src/manager/manager-project-info.ts +2 -0
- package/src/manager/manager-workspace-symbol.ts +31 -2
- package/src/manager/manager.ts +72 -2
- package/src/provider/lsp-refactor-provider.ts +9 -43
- package/src/provider/refactor-planning.ts +102 -50
- package/src/provider/semantic-edit-normalizer.ts +49 -3
- package/src/session/runtime-controller.ts +78 -18
- package/src/session/runtime-registry.ts +46 -2
- package/src/session/workspace-lsp-runtime.ts +14 -0
- package/src/workspace-path-policy.ts +30 -4
- package/src/config/lsp-settings.ts +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Dirent, lstatSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
+
import { loadAutomaticExclusionPatterns } from "@mrclrchtr/supi-core/config";
|
|
3
4
|
import ignore from "ignore";
|
|
4
|
-
import { loadLspSettings } from "./config/lsp-settings.ts";
|
|
5
5
|
|
|
6
6
|
/** Directory names that automatic LSP work never enters or selects. */
|
|
7
7
|
export const AUTOMATIC_LSP_EXCLUDED_DIRECTORIES: readonly string[] = Object.freeze([
|
|
@@ -22,15 +22,27 @@ export const AUTOMATIC_LSP_EXCLUDED_DIRECTORIES: readonly string[] = Object.free
|
|
|
22
22
|
|
|
23
23
|
const BUILT_IN_EXCLUSIONS = new Set(AUTOMATIC_LSP_EXCLUDED_DIRECTORIES);
|
|
24
24
|
|
|
25
|
+
/** Options for loading one workspace's automatic path policy. */
|
|
26
|
+
export interface AutomaticLspPathPolicyOptions {
|
|
27
|
+
/** Whether project-scoped SuPi configuration is trusted. */
|
|
28
|
+
projectTrusted?: boolean;
|
|
29
|
+
/** Global config home, used by tests and managed sessions. */
|
|
30
|
+
homeDir?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
/** Automatic path rules for one Workspace LSP runtime. The rules do not change. */
|
|
26
34
|
export interface AutomaticLspPathPolicy {
|
|
27
35
|
/** Canonical absolute workspace root used for all matching. */
|
|
28
36
|
readonly workspaceRoot: string;
|
|
37
|
+
/** The configured patterns captured by this immutable policy. */
|
|
38
|
+
readonly configuredPatterns?: readonly string[];
|
|
29
39
|
/**
|
|
30
40
|
* True when automatic LSP work can use the path.
|
|
31
41
|
* The policy reads the path kind when the caller does not supply it.
|
|
32
42
|
*/
|
|
33
43
|
isEligible(candidate: string, kind?: "file" | "directory"): boolean;
|
|
44
|
+
/** True when the shared configured list excludes the path. */
|
|
45
|
+
isConfiguredExcluded?(candidate: string, kind?: "file" | "directory"): boolean;
|
|
34
46
|
}
|
|
35
47
|
|
|
36
48
|
/** Create the automatic path rules for one Workspace LSP runtime. */
|
|
@@ -39,10 +51,20 @@ export function createAutomaticLspPathPolicy(
|
|
|
39
51
|
excludePatterns: readonly string[],
|
|
40
52
|
): AutomaticLspPathPolicy {
|
|
41
53
|
const canonicalRoot = canonicalPath(workspaceRoot);
|
|
42
|
-
const
|
|
54
|
+
const configuredPatterns = Object.freeze([...excludePatterns]);
|
|
55
|
+
const configuredExclusions = createIgnoreMatcher(configuredPatterns);
|
|
43
56
|
const repositoryRules = compileRepositoryRules(canonicalRoot, configuredExclusions);
|
|
44
57
|
return Object.freeze({
|
|
45
58
|
workspaceRoot: canonicalRoot,
|
|
59
|
+
configuredPatterns,
|
|
60
|
+
isConfiguredExcluded(candidate: string, kind?: "file" | "directory"): boolean {
|
|
61
|
+
const relativePath = normalizeCandidate(canonicalRoot, workspaceRoot, candidate);
|
|
62
|
+
if (relativePath === null || relativePath === "") return false;
|
|
63
|
+
const candidateKind = kind ?? readCandidateKind(canonicalRoot, relativePath);
|
|
64
|
+
return configuredExclusions.ignores(
|
|
65
|
+
candidateKind === "directory" ? `${relativePath}/` : relativePath,
|
|
66
|
+
);
|
|
67
|
+
},
|
|
46
68
|
isEligible(candidate: string, kind?: "file" | "directory"): boolean {
|
|
47
69
|
const relativePath = normalizeCandidate(canonicalRoot, workspaceRoot, candidate);
|
|
48
70
|
if (relativePath === null) return false;
|
|
@@ -62,8 +84,12 @@ export function createAutomaticLspPathPolicy(
|
|
|
62
84
|
* Create path rules for an automatic LSP helper used outside a runtime.
|
|
63
85
|
* Runtime-owned operations should pass the rules created at startup instead.
|
|
64
86
|
*/
|
|
65
|
-
export function createDefaultAutomaticLspPathPolicy(
|
|
66
|
-
|
|
87
|
+
export function createDefaultAutomaticLspPathPolicy(
|
|
88
|
+
workspaceRoot: string,
|
|
89
|
+
options: AutomaticLspPathPolicyOptions = {},
|
|
90
|
+
): AutomaticLspPathPolicy {
|
|
91
|
+
const excludePatterns = loadAutomaticExclusionPatterns(workspaceRoot, options);
|
|
92
|
+
return createAutomaticLspPathPolicy(workspaceRoot, excludePatterns);
|
|
67
93
|
}
|
|
68
94
|
|
|
69
95
|
/**
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// LSP settings used by workspace lifecycle and automatic path policy.
|
|
2
|
-
|
|
3
|
-
import { loadSupiConfig } from "@mrclrchtr/supi-core/config";
|
|
4
|
-
|
|
5
|
-
/** Effective non-server LSP settings. */
|
|
6
|
-
export interface LspSettings {
|
|
7
|
-
exclude: string[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const LSP_DEFAULTS: LspSettings = {
|
|
11
|
-
exclude: [],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/** Load effective LSP settings for one workspace. */
|
|
15
|
-
export function loadLspSettings(cwd: string, homeDir?: string): LspSettings {
|
|
16
|
-
const loaded = loadSupiConfig("lsp", cwd, LSP_DEFAULTS, { homeDir });
|
|
17
|
-
return {
|
|
18
|
-
exclude: Array.isArray(loaded.exclude)
|
|
19
|
-
? loaded.exclude.filter((entry): entry is string => typeof entry === "string")
|
|
20
|
-
: [],
|
|
21
|
-
};
|
|
22
|
-
}
|