@jbearak/sight 0.14.2 → 0.14.4
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/dist/sight-server.js +120 -83
- package/dist/sight-server.js.sha256 +1 -1
- package/package.json +2 -2
package/dist/sight-server.js
CHANGED
|
@@ -52,7 +52,7 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "@jbearak/sight",
|
|
55
|
-
version: "0.14.
|
|
55
|
+
version: "0.14.4",
|
|
56
56
|
type: "module",
|
|
57
57
|
workspaces: [
|
|
58
58
|
"client"
|
|
@@ -114,7 +114,7 @@ var init_package = __esm(() => {
|
|
|
114
114
|
author: "Jonathan Marc Bearak",
|
|
115
115
|
license: "GPL-3.0",
|
|
116
116
|
dependencies: {
|
|
117
|
-
"@jbearak/dta-parser": "^0.
|
|
117
|
+
"@jbearak/dta-parser": "^0.6.0",
|
|
118
118
|
picomatch: "^4.0.2",
|
|
119
119
|
"smol-toml": "^1.6.1",
|
|
120
120
|
"vscode-languageserver": "^9.0.1",
|
|
@@ -14595,6 +14595,13 @@ var init_parser = __esm(() => {
|
|
|
14595
14595
|
isArithmeticOperator(value) {
|
|
14596
14596
|
return value === "+" || value === "-" || value === "*" || value === "/" || value === "^";
|
|
14597
14597
|
}
|
|
14598
|
+
isMacroRefToken(token) {
|
|
14599
|
+
return token.type === "MACRO_REF_LOCAL" || token.type === "MACRO_REF_GLOBAL";
|
|
14600
|
+
}
|
|
14601
|
+
isAdjacentOperandFragment(prev_token, token) {
|
|
14602
|
+
const is_operand_like = (t) => t.type === "WORD" || t.type === "NUMBER" || this.isMacroRefToken(t);
|
|
14603
|
+
return is_operand_like(prev_token) && is_operand_like(token) && (this.isMacroRefToken(prev_token) || this.isMacroRefToken(token)) && this.isAdjacentToken(prev_token, token);
|
|
14604
|
+
}
|
|
14598
14605
|
isValidAfterComparison(token) {
|
|
14599
14606
|
if (token.type === "RPAREN") {
|
|
14600
14607
|
return true;
|
|
@@ -15309,11 +15316,12 @@ var init_parser = __esm(() => {
|
|
|
15309
15316
|
continuation.note_continuation(token);
|
|
15310
15317
|
continue;
|
|
15311
15318
|
}
|
|
15319
|
+
const is_operand_fragment = prev_token !== null && this.isAdjacentOperandFragment(prev_token, token);
|
|
15312
15320
|
if (paren_depth === 0 && bracket_depth === 0) {
|
|
15313
15321
|
if (token.type === "COMMA") {
|
|
15314
15322
|
break;
|
|
15315
15323
|
}
|
|
15316
|
-
if (stop_at_in && token.type === "WORD" && token.value === "in") {
|
|
15324
|
+
if (stop_at_in && token.type === "WORD" && token.value === "in" && !is_operand_fragment) {
|
|
15317
15325
|
break;
|
|
15318
15326
|
}
|
|
15319
15327
|
if (token.type === "LBRACE") {
|
|
@@ -15328,7 +15336,7 @@ var init_parser = __esm(() => {
|
|
|
15328
15336
|
in_string_context = !in_string_context;
|
|
15329
15337
|
}
|
|
15330
15338
|
const current_state = state_stack[state_stack.length - 1];
|
|
15331
|
-
if (current_state === "AFTER_RHS" && token.type !== "LPAREN" && token.type !== "RPAREN" && token.type !== "LBRACKET" && token.type !== "RBRACKET" && bracket_depth === 0 && !in_string_context && !is_delimiter_only) {
|
|
15339
|
+
if (current_state === "AFTER_RHS" && token.type !== "LPAREN" && token.type !== "RPAREN" && token.type !== "LBRACKET" && token.type !== "RBRACKET" && bracket_depth === 0 && !in_string_context && !is_delimiter_only && !is_operand_fragment) {
|
|
15332
15340
|
if (prev_token && this.detectSplitLiteral(prev_token, token)) {} else if (!this.isValidAfterComparison(token)) {
|
|
15333
15341
|
this.addError(`Unexpected token '${token.value}' after comparison expression. Did you mean to use '&' or '|'?`, token.range, "STRAY_TOKEN_IN_CONDITION" /* STRAY_TOKEN_IN_CONDITION */);
|
|
15334
15342
|
}
|
|
@@ -25014,6 +25022,23 @@ var init_findalias_resolver = __esm(() => {
|
|
|
25014
25022
|
};
|
|
25015
25023
|
});
|
|
25016
25024
|
|
|
25025
|
+
// src/utils/source-discovery-policy.ts
|
|
25026
|
+
import * as path9 from "path";
|
|
25027
|
+
function is_hidden_source_path(file_path, scan_roots) {
|
|
25028
|
+
const root = get_workspace_root_for_path(scan_roots, file_path);
|
|
25029
|
+
if (!root)
|
|
25030
|
+
return false;
|
|
25031
|
+
const relative_path = path9.relative(root, path9.resolve(file_path));
|
|
25032
|
+
if (relative_path === ".." || relative_path.startsWith(`..${path9.sep}`) || path9.isAbsolute(relative_path)) {
|
|
25033
|
+
return false;
|
|
25034
|
+
}
|
|
25035
|
+
const the_directories = relative_path.split(path9.sep).slice(0, -1);
|
|
25036
|
+
return the_directories.some((my_directory) => my_directory.startsWith("."));
|
|
25037
|
+
}
|
|
25038
|
+
var init_source_discovery_policy = __esm(() => {
|
|
25039
|
+
init_workspace_roots();
|
|
25040
|
+
});
|
|
25041
|
+
|
|
25017
25042
|
// node_modules/picomatch/lib/constants.js
|
|
25018
25043
|
var require_constants = __commonJS((exports, module) => {
|
|
25019
25044
|
var WIN_SLASH = "\\\\/";
|
|
@@ -25212,8 +25237,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
25212
25237
|
}
|
|
25213
25238
|
return output;
|
|
25214
25239
|
};
|
|
25215
|
-
exports.basename = (
|
|
25216
|
-
const segs =
|
|
25240
|
+
exports.basename = (path10, { windows } = {}) => {
|
|
25241
|
+
const segs = path10.split(windows ? /[\\/]/ : "/");
|
|
25217
25242
|
const last = segs[segs.length - 1];
|
|
25218
25243
|
if (last === "") {
|
|
25219
25244
|
return segs[segs.length - 2];
|
|
@@ -26694,7 +26719,7 @@ var require_picomatch2 = __commonJS((exports, module) => {
|
|
|
26694
26719
|
});
|
|
26695
26720
|
|
|
26696
26721
|
// src/utils/exclude-matcher.ts
|
|
26697
|
-
import
|
|
26722
|
+
import path10 from "path";
|
|
26698
26723
|
function normalize_pattern(raw) {
|
|
26699
26724
|
const trimmed = raw.trim();
|
|
26700
26725
|
if (trimmed === "")
|
|
@@ -26716,13 +26741,13 @@ function derive_dir_pattern(pattern) {
|
|
|
26716
26741
|
return stripped === "" ? pattern : stripped;
|
|
26717
26742
|
}
|
|
26718
26743
|
function relative_to_containing_root(abs_path, workspace_roots) {
|
|
26719
|
-
const target =
|
|
26744
|
+
const target = path10.resolve(abs_path);
|
|
26720
26745
|
let best = null;
|
|
26721
26746
|
let best_root_length = -1;
|
|
26722
26747
|
for (const my_root of workspace_roots) {
|
|
26723
|
-
const root =
|
|
26724
|
-
const my_relative =
|
|
26725
|
-
const contained = my_relative === "" || my_relative !== ".." && !my_relative.startsWith(`..${
|
|
26748
|
+
const root = path10.resolve(my_root);
|
|
26749
|
+
const my_relative = path10.relative(root, target);
|
|
26750
|
+
const contained = my_relative === "" || my_relative !== ".." && !my_relative.startsWith(`..${path10.sep}`) && !path10.isAbsolute(my_relative);
|
|
26726
26751
|
if (contained && root.length > best_root_length) {
|
|
26727
26752
|
best = my_relative;
|
|
26728
26753
|
best_root_length = root.length;
|
|
@@ -26730,7 +26755,7 @@ function relative_to_containing_root(abs_path, workspace_roots) {
|
|
|
26730
26755
|
}
|
|
26731
26756
|
if (best === null)
|
|
26732
26757
|
return null;
|
|
26733
|
-
return best.split(
|
|
26758
|
+
return best.split(path10.sep).join("/");
|
|
26734
26759
|
}
|
|
26735
26760
|
function create_exclude_matcher(patterns) {
|
|
26736
26761
|
const compiled = [];
|
|
@@ -26770,12 +26795,12 @@ function create_exclude_matcher(patterns) {
|
|
|
26770
26795
|
return {
|
|
26771
26796
|
is_empty: false,
|
|
26772
26797
|
is_excluded_file(abs_path, workspace_roots) {
|
|
26773
|
-
const
|
|
26774
|
-
if (
|
|
26798
|
+
const relative5 = relative_to_containing_root(abs_path, workspace_roots);
|
|
26799
|
+
if (relative5 === null || relative5 === "")
|
|
26775
26800
|
return false;
|
|
26776
26801
|
let excluded = false;
|
|
26777
26802
|
for (const my_rule of compiled) {
|
|
26778
|
-
if (my_rule.match(
|
|
26803
|
+
if (my_rule.match(relative5)) {
|
|
26779
26804
|
excluded = !my_rule.is_negated;
|
|
26780
26805
|
}
|
|
26781
26806
|
}
|
|
@@ -26784,8 +26809,8 @@ function create_exclude_matcher(patterns) {
|
|
|
26784
26809
|
is_excluded_dir(abs_path, workspace_roots) {
|
|
26785
26810
|
if (dir_match === null)
|
|
26786
26811
|
return false;
|
|
26787
|
-
const
|
|
26788
|
-
return
|
|
26812
|
+
const relative5 = relative_to_containing_root(abs_path, workspace_roots);
|
|
26813
|
+
return relative5 !== null && relative5 !== "" && dir_match(relative5);
|
|
26789
26814
|
}
|
|
26790
26815
|
};
|
|
26791
26816
|
}
|
|
@@ -26802,7 +26827,7 @@ var init_exclude_matcher = __esm(() => {
|
|
|
26802
26827
|
|
|
26803
26828
|
// src/indexer/index.ts
|
|
26804
26829
|
import * as fs9 from "fs";
|
|
26805
|
-
import * as
|
|
26830
|
+
import * as path11 from "path";
|
|
26806
26831
|
var MAX_PARALLEL = 4, YIELD_INTERVAL_MS = 100, INDEX_DEBOUNCE_MS = 200, WorkspaceIndexer;
|
|
26807
26832
|
var init_indexer = __esm(() => {
|
|
26808
26833
|
init_esm();
|
|
@@ -26818,6 +26843,7 @@ var init_indexer = __esm(() => {
|
|
|
26818
26843
|
init_stata_install_paths();
|
|
26819
26844
|
init_findalias_resolver();
|
|
26820
26845
|
init_file_path_utils();
|
|
26846
|
+
init_source_discovery_policy();
|
|
26821
26847
|
init_exclude_matcher();
|
|
26822
26848
|
WorkspaceIndexer = class WorkspaceIndexer {
|
|
26823
26849
|
symbol_index = new Map;
|
|
@@ -26853,6 +26879,7 @@ var init_indexer = __esm(() => {
|
|
|
26853
26879
|
is_processing_queue = false;
|
|
26854
26880
|
on_graph_change_callback;
|
|
26855
26881
|
workspace_roots = [];
|
|
26882
|
+
scan_roots = [];
|
|
26856
26883
|
scope_resolver;
|
|
26857
26884
|
scope_resolver_config = {};
|
|
26858
26885
|
set_dependency_graph(graph) {
|
|
@@ -26956,7 +26983,11 @@ var init_indexer = __esm(() => {
|
|
|
26956
26983
|
return;
|
|
26957
26984
|
}
|
|
26958
26985
|
this.ado_paths = ado_paths;
|
|
26959
|
-
this.workspace_roots = workspace_folders.map((f) =>
|
|
26986
|
+
this.workspace_roots = workspace_folders.map((f) => path11.resolve(f));
|
|
26987
|
+
this.scan_roots = [
|
|
26988
|
+
...this.workspace_roots,
|
|
26989
|
+
...ado_paths.map((my_path) => path11.resolve(my_path))
|
|
26990
|
+
];
|
|
26960
26991
|
this.help_search_paths = discover_stata_ado_paths();
|
|
26961
26992
|
const start_time = Date.now();
|
|
26962
26993
|
for (const folder of [...workspace_folders, ...this.ado_paths]) {
|
|
@@ -26988,9 +27019,9 @@ var init_indexer = __esm(() => {
|
|
|
26988
27019
|
for (const entry of entries) {
|
|
26989
27020
|
if (!this.is_active_generation(generation))
|
|
26990
27021
|
break;
|
|
26991
|
-
const entry_path =
|
|
27022
|
+
const entry_path = path11.join(dir_path, entry.name);
|
|
26992
27023
|
if (entry.isDirectory()) {
|
|
26993
|
-
if (
|
|
27024
|
+
if (entry.name.startsWith(".")) {
|
|
26994
27025
|
continue;
|
|
26995
27026
|
}
|
|
26996
27027
|
if (!this.exclude_matcher.is_empty && this.exclude_matcher.is_excluded_dir(entry_path, this.workspace_roots)) {
|
|
@@ -27020,7 +27051,7 @@ var init_indexer = __esm(() => {
|
|
|
27020
27051
|
const now = Date.now();
|
|
27021
27052
|
if (now - last_yield_time.value > YIELD_INTERVAL_MS) {
|
|
27022
27053
|
last_yield_time.value = now;
|
|
27023
|
-
await new Promise((
|
|
27054
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
27024
27055
|
}
|
|
27025
27056
|
}
|
|
27026
27057
|
};
|
|
@@ -27064,6 +27095,8 @@ var init_indexer = __esm(() => {
|
|
|
27064
27095
|
if (!this.is_active_generation(generation) || !this.enabled)
|
|
27065
27096
|
return;
|
|
27066
27097
|
const file_uri = URI.file(file_path).toString();
|
|
27098
|
+
if (is_hidden_source_path(file_path, this.scan_roots))
|
|
27099
|
+
return;
|
|
27067
27100
|
if (!this.exclude_matcher.is_empty && this.exclude_matcher.is_excluded_file(file_path, this.workspace_roots)) {
|
|
27068
27101
|
this.clear_stale_entry(file_uri);
|
|
27069
27102
|
return;
|
|
@@ -27087,7 +27120,7 @@ var init_indexer = __esm(() => {
|
|
|
27087
27120
|
return;
|
|
27088
27121
|
if (!already_indexed && this.should_skip_for_max_indexed_files(file_uri))
|
|
27089
27122
|
return;
|
|
27090
|
-
if (
|
|
27123
|
+
if (path11.extname(file_path).toLowerCase() === ".mata") {
|
|
27091
27124
|
await this.index_mata_file(content, file_uri, generation);
|
|
27092
27125
|
return;
|
|
27093
27126
|
}
|
|
@@ -27101,7 +27134,7 @@ var init_indexer = __esm(() => {
|
|
|
27101
27134
|
if (own_working_directory === undefined && this.scope_resolver) {
|
|
27102
27135
|
effective_working_directory = await this.scope_resolver.resolve_inherited_working_directory(directive_result.directives, file_uri, directive_result.standalone !== undefined, this.scope_resolver_config);
|
|
27103
27136
|
}
|
|
27104
|
-
const my_caller_dir =
|
|
27137
|
+
const my_caller_dir = path11.dirname(file_path);
|
|
27105
27138
|
const { timeline: cd_timeline } = build_cd_timeline({
|
|
27106
27139
|
starting_wd: effective_working_directory,
|
|
27107
27140
|
caller_dir: my_caller_dir,
|
|
@@ -27216,6 +27249,8 @@ var init_indexer = __esm(() => {
|
|
|
27216
27249
|
schedule_update(file_path) {
|
|
27217
27250
|
if (!this.enabled)
|
|
27218
27251
|
return;
|
|
27252
|
+
if (is_hidden_source_path(file_path, this.scan_roots))
|
|
27253
|
+
return;
|
|
27219
27254
|
const existing = this.pending_updates.get(file_path);
|
|
27220
27255
|
if (existing) {
|
|
27221
27256
|
clearTimeout(existing);
|
|
@@ -27240,7 +27275,7 @@ var init_indexer = __esm(() => {
|
|
|
27240
27275
|
break;
|
|
27241
27276
|
this.update_queue.delete(file_path);
|
|
27242
27277
|
await this.index_file(file_path, generation);
|
|
27243
|
-
await new Promise((
|
|
27278
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
27244
27279
|
}
|
|
27245
27280
|
} finally {
|
|
27246
27281
|
this.is_processing_queue = false;
|
|
@@ -27499,17 +27534,17 @@ var init_indexer = __esm(() => {
|
|
|
27499
27534
|
...this.help_search_paths
|
|
27500
27535
|
];
|
|
27501
27536
|
for (const my_dir of the_search_dirs) {
|
|
27502
|
-
const my_subdir_path =
|
|
27537
|
+
const my_subdir_path = path11.join(my_dir, my_first_letter, my_basename);
|
|
27503
27538
|
try {
|
|
27504
27539
|
await fs9.promises.access(my_subdir_path);
|
|
27505
27540
|
return my_subdir_path;
|
|
27506
27541
|
} catch {}
|
|
27507
|
-
const my_direct_path =
|
|
27542
|
+
const my_direct_path = path11.join(my_dir, my_basename);
|
|
27508
27543
|
try {
|
|
27509
27544
|
await fs9.promises.access(my_direct_path);
|
|
27510
27545
|
return my_direct_path;
|
|
27511
27546
|
} catch {}
|
|
27512
|
-
if (!this.workspace_roots.includes(
|
|
27547
|
+
if (!this.workspace_roots.includes(path11.resolve(my_dir))) {
|
|
27513
27548
|
continue;
|
|
27514
27549
|
}
|
|
27515
27550
|
const my_recursive_match = await this.find_sthlp_file_recursive(my_dir, my_basename);
|
|
@@ -27533,12 +27568,12 @@ var init_indexer = __esm(() => {
|
|
|
27533
27568
|
...this.help_search_paths
|
|
27534
27569
|
];
|
|
27535
27570
|
for (const my_dir of the_search_dirs) {
|
|
27536
|
-
const my_subdir_path =
|
|
27571
|
+
const my_subdir_path = path11.join(my_dir, my_first_letter, my_basename);
|
|
27537
27572
|
try {
|
|
27538
27573
|
await fs9.promises.access(my_subdir_path);
|
|
27539
27574
|
return my_subdir_path;
|
|
27540
27575
|
} catch {}
|
|
27541
|
-
const my_direct_path =
|
|
27576
|
+
const my_direct_path = path11.join(my_dir, my_basename);
|
|
27542
27577
|
try {
|
|
27543
27578
|
await fs9.promises.access(my_direct_path);
|
|
27544
27579
|
return my_direct_path;
|
|
@@ -27550,7 +27585,7 @@ var init_indexer = __esm(() => {
|
|
|
27550
27585
|
try {
|
|
27551
27586
|
const the_entries = await fs9.promises.readdir(dir);
|
|
27552
27587
|
const the_matches = the_entries.filter((my_entry) => my_entry.startsWith(prefix) && my_entry.endsWith(".sthlp")).sort();
|
|
27553
|
-
return the_matches.map((my_entry) =>
|
|
27588
|
+
return the_matches.map((my_entry) => path11.join(dir, my_entry));
|
|
27554
27589
|
} catch {
|
|
27555
27590
|
return [];
|
|
27556
27591
|
}
|
|
@@ -27574,7 +27609,7 @@ var init_indexer = __esm(() => {
|
|
|
27574
27609
|
const my_prefix = `${my_variant}_`;
|
|
27575
27610
|
const my_first_letter = my_variant.charAt(0).toLowerCase();
|
|
27576
27611
|
for (const my_dir of the_search_dirs) {
|
|
27577
|
-
const my_subdir =
|
|
27612
|
+
const my_subdir = path11.join(my_dir, my_first_letter);
|
|
27578
27613
|
const the_subdir_matches = await this.list_matching_sthlp(my_subdir, my_prefix);
|
|
27579
27614
|
for (const my_match of the_subdir_matches) {
|
|
27580
27615
|
if (!the_seen.has(my_match)) {
|
|
@@ -27619,7 +27654,7 @@ var init_indexer = __esm(() => {
|
|
|
27619
27654
|
continue;
|
|
27620
27655
|
}
|
|
27621
27656
|
for (const my_dirent of the_entries) {
|
|
27622
|
-
const my_path =
|
|
27657
|
+
const my_path = path11.join(my_entry.path, my_dirent.name);
|
|
27623
27658
|
if (my_dirent.isDirectory()) {
|
|
27624
27659
|
if (!WorkspaceIndexer.EXCLUDED_DIRS.has(my_dirent.name)) {
|
|
27625
27660
|
the_dirs.push({
|
|
@@ -27638,8 +27673,8 @@ var init_indexer = __esm(() => {
|
|
|
27638
27673
|
}
|
|
27639
27674
|
resolve_program(name, referring_uri) {
|
|
27640
27675
|
const referring_path = URI.parse(referring_uri).fsPath;
|
|
27641
|
-
const current_dir =
|
|
27642
|
-
const local_ado =
|
|
27676
|
+
const current_dir = path11.dirname(referring_path);
|
|
27677
|
+
const local_ado = path11.join(current_dir, `${name}.ado`);
|
|
27643
27678
|
if (fs9.existsSync(local_ado)) {
|
|
27644
27679
|
const local_uri = URI.file(local_ado).toString();
|
|
27645
27680
|
const entry = this.symbol_index.get(local_uri);
|
|
@@ -31440,7 +31475,7 @@ function format_help_link(topic, display) {
|
|
|
31440
31475
|
|
|
31441
31476
|
// src/providers/completion.ts
|
|
31442
31477
|
import * as fs10 from "fs";
|
|
31443
|
-
import * as
|
|
31478
|
+
import * as path12 from "path";
|
|
31444
31479
|
function coerce_macro_map(value) {
|
|
31445
31480
|
if (value instanceof Map) {
|
|
31446
31481
|
return value;
|
|
@@ -32206,7 +32241,7 @@ class CompletionProvider {
|
|
|
32206
32241
|
const path_parts = clean_path.split("/");
|
|
32207
32242
|
search_prefix = path_parts.pop() || "";
|
|
32208
32243
|
const dir_path = path_parts.join("/");
|
|
32209
|
-
base_dir =
|
|
32244
|
+
base_dir = path12.resolve(workspace_root, dir_path);
|
|
32210
32245
|
} else {
|
|
32211
32246
|
search_prefix = clean_path;
|
|
32212
32247
|
}
|
|
@@ -32222,7 +32257,7 @@ class CompletionProvider {
|
|
|
32222
32257
|
if (search_prefix && !entry.name.toLowerCase().startsWith(search_prefix.toLowerCase())) {
|
|
32223
32258
|
continue;
|
|
32224
32259
|
}
|
|
32225
|
-
const entry_kind = classify_entry_sync(entry,
|
|
32260
|
+
const entry_kind = classify_entry_sync(entry, path12.join(base_dir, entry.name), fs10);
|
|
32226
32261
|
if (entry_kind === "directory") {
|
|
32227
32262
|
completions.push({
|
|
32228
32263
|
label: entry.name + "/",
|
|
@@ -32250,17 +32285,17 @@ class CompletionProvider {
|
|
|
32250
32285
|
get_workspace_root(document_uri) {
|
|
32251
32286
|
try {
|
|
32252
32287
|
const file_path = document_uri.replace(/^file:\/\//, "");
|
|
32253
|
-
let current_dir =
|
|
32254
|
-
while (current_dir !==
|
|
32288
|
+
let current_dir = path12.dirname(file_path);
|
|
32289
|
+
while (current_dir !== path12.dirname(current_dir)) {
|
|
32255
32290
|
const markers = [".git", "sight.toml", ".sight.json", "package.json", ".vscode"];
|
|
32256
32291
|
for (const marker of markers) {
|
|
32257
|
-
if (fs10.existsSync(
|
|
32292
|
+
if (fs10.existsSync(path12.join(current_dir, marker))) {
|
|
32258
32293
|
return current_dir;
|
|
32259
32294
|
}
|
|
32260
32295
|
}
|
|
32261
|
-
current_dir =
|
|
32296
|
+
current_dir = path12.dirname(current_dir);
|
|
32262
32297
|
}
|
|
32263
|
-
return
|
|
32298
|
+
return path12.dirname(file_path);
|
|
32264
32299
|
} catch {
|
|
32265
32300
|
return null;
|
|
32266
32301
|
}
|
|
@@ -33745,7 +33780,7 @@ function create_shutdown_handler(deps, disposables) {
|
|
|
33745
33780
|
const SHUTDOWN_TIMEOUT_MS = 500;
|
|
33746
33781
|
await Promise.race([
|
|
33747
33782
|
deps.document_store.dispose(),
|
|
33748
|
-
new Promise((
|
|
33783
|
+
new Promise((resolve11) => setTimeout(resolve11, SHUTDOWN_TIMEOUT_MS))
|
|
33749
33784
|
]);
|
|
33750
33785
|
}
|
|
33751
33786
|
deps?.scope_resolver?.dispose();
|
|
@@ -34500,26 +34535,26 @@ var init_shared = __esm(() => {
|
|
|
34500
34535
|
|
|
34501
34536
|
// src/cli/source-files.ts
|
|
34502
34537
|
import * as fs12 from "fs";
|
|
34503
|
-
import * as
|
|
34538
|
+
import * as path13 from "path";
|
|
34504
34539
|
import { TextDecoder } from "util";
|
|
34505
34540
|
function canonicalize_existing_path(file_path) {
|
|
34506
34541
|
return fs12.realpathSync.native(file_path);
|
|
34507
34542
|
}
|
|
34508
34543
|
function workspace_relative(workspace_root, file_path) {
|
|
34509
|
-
const
|
|
34510
|
-
const inside =
|
|
34511
|
-
return { relative:
|
|
34544
|
+
const relative6 = path13.relative(workspace_root, file_path);
|
|
34545
|
+
const inside = relative6 !== ".." && !relative6.startsWith(`..${path13.sep}`) && !path13.isAbsolute(relative6);
|
|
34546
|
+
return { relative: relative6, inside };
|
|
34512
34547
|
}
|
|
34513
34548
|
function relative_path(workspace_root, file_path) {
|
|
34514
|
-
const { relative:
|
|
34515
|
-
if (
|
|
34549
|
+
const { relative: relative6 } = workspace_relative(workspace_root, file_path);
|
|
34550
|
+
if (relative6 === "") {
|
|
34516
34551
|
return ".";
|
|
34517
34552
|
}
|
|
34518
|
-
return
|
|
34553
|
+
return path13.isAbsolute(relative6) ? file_path : relative6.split(path13.sep).join("/");
|
|
34519
34554
|
}
|
|
34520
34555
|
function is_within_workspace(workspace_root, file_path) {
|
|
34521
|
-
const { relative:
|
|
34522
|
-
return
|
|
34556
|
+
const { relative: relative6, inside } = workspace_relative(workspace_root, file_path);
|
|
34557
|
+
return relative6 === "" || relative6.length > 0 && inside;
|
|
34523
34558
|
}
|
|
34524
34559
|
function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_matcher) {
|
|
34525
34560
|
let entries;
|
|
@@ -34530,9 +34565,9 @@ function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_m
|
|
|
34530
34565
|
return;
|
|
34531
34566
|
}
|
|
34532
34567
|
for (const entry of entries) {
|
|
34533
|
-
const entry_path =
|
|
34568
|
+
const entry_path = path13.join(dir_path, entry.name);
|
|
34534
34569
|
if (entry.isDirectory()) {
|
|
34535
|
-
if (
|
|
34570
|
+
if (entry.name.startsWith("."))
|
|
34536
34571
|
continue;
|
|
34537
34572
|
if (!exclude_matcher.is_empty && exclude_matcher.is_excluded_dir(entry_path, workspace_roots)) {
|
|
34538
34573
|
continue;
|
|
@@ -34549,7 +34584,7 @@ function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_m
|
|
|
34549
34584
|
function collect_report_targets(input_paths, workspace_root, cwd, exclude_patterns = []) {
|
|
34550
34585
|
const operator_errors = [];
|
|
34551
34586
|
const source_paths = [];
|
|
34552
|
-
let normalized_root =
|
|
34587
|
+
let normalized_root = path13.resolve(workspace_root);
|
|
34553
34588
|
try {
|
|
34554
34589
|
normalized_root = canonicalize_existing_path(normalized_root);
|
|
34555
34590
|
} catch {}
|
|
@@ -34558,7 +34593,7 @@ function collect_report_targets(input_paths, workspace_root, cwd, exclude_patter
|
|
|
34558
34593
|
const has_explicit_paths = input_paths.length > 0;
|
|
34559
34594
|
const paths_to_collect = input_paths.length > 0 ? input_paths : [normalized_root];
|
|
34560
34595
|
for (const input_path of paths_to_collect) {
|
|
34561
|
-
const resolved_path =
|
|
34596
|
+
const resolved_path = path13.resolve(cwd, input_path);
|
|
34562
34597
|
if (!fs12.existsSync(resolved_path)) {
|
|
34563
34598
|
operator_errors.push(`path does not exist: ${input_path}`);
|
|
34564
34599
|
continue;
|
|
@@ -34706,7 +34741,7 @@ __export(exports_check, {
|
|
|
34706
34741
|
build_check_context: () => build_check_context
|
|
34707
34742
|
});
|
|
34708
34743
|
import * as fs13 from "fs";
|
|
34709
|
-
import * as
|
|
34744
|
+
import * as path14 from "path";
|
|
34710
34745
|
function parse_required_option_value(argv, index, flag, value_kind, inline_value) {
|
|
34711
34746
|
if (inline_value !== undefined) {
|
|
34712
34747
|
if (inline_value.length === 0) {
|
|
@@ -34872,7 +34907,7 @@ function load_check_config(options) {
|
|
|
34872
34907
|
warnings: validation_warnings
|
|
34873
34908
|
};
|
|
34874
34909
|
}
|
|
34875
|
-
const loaded = options.config_path ? load_toml_file(
|
|
34910
|
+
const loaded = options.config_path ? load_toml_file(path14.resolve(options.cwd, options.config_path)) : discover_and_load_project_config(options.workspace_root);
|
|
34876
34911
|
if (loaded.kind === "load-failed") {
|
|
34877
34912
|
return {
|
|
34878
34913
|
kind: "operator-error",
|
|
@@ -34961,6 +34996,7 @@ async function collect_check_diagnostics(context, workspace_root, config, target
|
|
|
34961
34996
|
const workspace_symbols = context.workspace_indexer.get_all_symbols();
|
|
34962
34997
|
const files_indexed = context.workspace_indexer.get_metrics().files_indexed;
|
|
34963
34998
|
const exclude_matcher = create_exclude_matcher(config.exclude);
|
|
34999
|
+
const scan_roots = [workspace_root, ...config.adoPaths];
|
|
34964
35000
|
const the_slots = new Array(targets.length);
|
|
34965
35001
|
async function collect_target_diagnostics(target, document_store) {
|
|
34966
35002
|
const records = [];
|
|
@@ -34978,7 +35014,7 @@ async function collect_check_diagnostics(context, workspace_root, config, target
|
|
|
34978
35014
|
}
|
|
34979
35015
|
return records;
|
|
34980
35016
|
}
|
|
34981
|
-
if (is_within_workspace(workspace_root, target.path) && files_indexed >= config.cross_file.max_indexed_files && !context.workspace_indexer.has_indexed_file(uri) && !exclude_matcher.is_excluded_file(target.path, [workspace_root])) {
|
|
35017
|
+
if (is_within_workspace(workspace_root, target.path) && files_indexed >= config.cross_file.max_indexed_files && !context.workspace_indexer.has_indexed_file(uri) && !is_hidden_source_path(target.path, scan_roots) && !exclude_matcher.is_excluded_file(target.path, [workspace_root])) {
|
|
34982
35018
|
records.push(diagnostic_record(target.relative_path, index_limit_diagnostic()));
|
|
34983
35019
|
return records;
|
|
34984
35020
|
}
|
|
@@ -35062,7 +35098,7 @@ async function run_check_with_cwd(argv, cwd, output = DEFAULT_OUTPUT) {
|
|
|
35062
35098
|
`);
|
|
35063
35099
|
return EXIT_OK;
|
|
35064
35100
|
}
|
|
35065
|
-
const resolved_workspace_root =
|
|
35101
|
+
const resolved_workspace_root = path14.resolve(cwd, result.args.workspace ?? ".");
|
|
35066
35102
|
let is_workspace_directory = false;
|
|
35067
35103
|
try {
|
|
35068
35104
|
is_workspace_directory = fs13.statSync(resolved_workspace_root).isDirectory();
|
|
@@ -35150,6 +35186,7 @@ var init_check = __esm(() => {
|
|
|
35150
35186
|
init_logger();
|
|
35151
35187
|
init_source_files();
|
|
35152
35188
|
init_exclude_matcher();
|
|
35189
|
+
init_source_discovery_policy();
|
|
35153
35190
|
init_shared();
|
|
35154
35191
|
DEFAULT_OUTPUT = {
|
|
35155
35192
|
stdout: (text) => process.stdout.write(text),
|
|
@@ -35425,7 +35462,7 @@ function is_position_in_range3(position, range) {
|
|
|
35425
35462
|
}
|
|
35426
35463
|
|
|
35427
35464
|
// src/providers/hover.ts
|
|
35428
|
-
import * as
|
|
35465
|
+
import * as path15 from "path";
|
|
35429
35466
|
function has_definition_index(hit) {
|
|
35430
35467
|
return typeof hit.definition_index === "number";
|
|
35431
35468
|
}
|
|
@@ -36775,7 +36812,7 @@ ${source_info}${footer}`
|
|
|
36775
36812
|
if (this.looks_like_uri_scheme(uri_or_path)) {
|
|
36776
36813
|
return null;
|
|
36777
36814
|
}
|
|
36778
|
-
return
|
|
36815
|
+
return path15.resolve(uri_or_path);
|
|
36779
36816
|
}
|
|
36780
36817
|
escape_markdown_link_text(text) {
|
|
36781
36818
|
return text.replace(/[\\[\]()]/g, "\\$&");
|
|
@@ -36795,11 +36832,11 @@ ${source_info}${footer}`
|
|
|
36795
36832
|
if (workspace_fs_path === null) {
|
|
36796
36833
|
return fs_path;
|
|
36797
36834
|
}
|
|
36798
|
-
const
|
|
36799
|
-
if (
|
|
36835
|
+
const relative7 = path15.relative(workspace_fs_path, fs_path);
|
|
36836
|
+
if (relative7.startsWith("..") || path15.isAbsolute(relative7)) {
|
|
36800
36837
|
return fs_path;
|
|
36801
36838
|
}
|
|
36802
|
-
return
|
|
36839
|
+
return relative7;
|
|
36803
36840
|
}
|
|
36804
36841
|
format_source_link(source_uri, current_uri, workspace_root) {
|
|
36805
36842
|
const source_path = this.normalize_file_path(source_uri);
|
|
@@ -37150,7 +37187,7 @@ var init_hover = __esm(() => {
|
|
|
37150
37187
|
});
|
|
37151
37188
|
|
|
37152
37189
|
// src/providers/definition.ts
|
|
37153
|
-
import * as
|
|
37190
|
+
import * as path16 from "path";
|
|
37154
37191
|
|
|
37155
37192
|
class DefinitionProvider {
|
|
37156
37193
|
workspace_roots = [];
|
|
@@ -37895,7 +37932,7 @@ class DefinitionProvider {
|
|
|
37895
37932
|
if (!the_call) {
|
|
37896
37933
|
return { matched: false, path: null };
|
|
37897
37934
|
}
|
|
37898
|
-
const current_dir =
|
|
37935
|
+
const current_dir = path16.dirname(URI.parse(document.uri).fsPath);
|
|
37899
37936
|
const my_outcome = resolve_forward_call_rich(file_path, current_dir, the_call.working_directory, { workspace_roots: this.workspace_roots });
|
|
37900
37937
|
if (my_outcome.kind === "exact" || my_outcome.kind === "case_only") {
|
|
37901
37938
|
return { matched: true, path: my_outcome.path };
|
|
@@ -37904,8 +37941,8 @@ class DefinitionProvider {
|
|
|
37904
37941
|
}
|
|
37905
37942
|
resolve_file_path(current_uri, file_path) {
|
|
37906
37943
|
const current_path = URI.parse(current_uri).fsPath;
|
|
37907
|
-
const current_dir =
|
|
37908
|
-
const resolved_path =
|
|
37944
|
+
const current_dir = path16.dirname(current_path);
|
|
37945
|
+
const resolved_path = path16.resolve(current_dir, file_path);
|
|
37909
37946
|
const the_roots_set = new Set(this.workspace_roots);
|
|
37910
37947
|
the_roots_set.add(current_dir);
|
|
37911
37948
|
const the_roots = Array.from(the_roots_set);
|
|
@@ -38479,7 +38516,7 @@ class ReferencesProvider {
|
|
|
38479
38516
|
}
|
|
38480
38517
|
file_count++;
|
|
38481
38518
|
if (file_count % 10 === 0) {
|
|
38482
|
-
await new Promise((
|
|
38519
|
+
await new Promise((resolve15) => setTimeout(resolve15, 0));
|
|
38483
38520
|
if (cancellation_token?.isCancellationRequested) {
|
|
38484
38521
|
break;
|
|
38485
38522
|
}
|
|
@@ -38905,7 +38942,7 @@ var init_section_detector = __esm(() => {
|
|
|
38905
38942
|
});
|
|
38906
38943
|
|
|
38907
38944
|
// src/providers/symbols.ts
|
|
38908
|
-
import * as
|
|
38945
|
+
import * as path17 from "path";
|
|
38909
38946
|
function is_position_in_range4(position, range) {
|
|
38910
38947
|
if (position.line < range.start.line) {
|
|
38911
38948
|
return false;
|
|
@@ -39301,7 +39338,7 @@ class SymbolProvider {
|
|
|
39301
39338
|
}
|
|
39302
39339
|
}
|
|
39303
39340
|
for (const document of all_documents) {
|
|
39304
|
-
const my_basename =
|
|
39341
|
+
const my_basename = path17.basename(document.uri);
|
|
39305
39342
|
for (const my_program of document.symbols.programs.values()) {
|
|
39306
39343
|
if (my_program.name.toLowerCase().includes(lower_query)) {
|
|
39307
39344
|
symbols.push({
|
|
@@ -41746,8 +41783,8 @@ class DocumentDebounceManager {
|
|
|
41746
41783
|
if (prev_resolver) {
|
|
41747
41784
|
prev_resolver();
|
|
41748
41785
|
}
|
|
41749
|
-
const promise = new Promise((
|
|
41750
|
-
this.pending_resolvers.set(uri,
|
|
41786
|
+
const promise = new Promise((resolve15) => {
|
|
41787
|
+
this.pending_resolvers.set(uri, resolve15);
|
|
41751
41788
|
});
|
|
41752
41789
|
this.pending_promises.set(uri, promise);
|
|
41753
41790
|
const timer = setTimeout(() => {
|
|
@@ -41773,9 +41810,9 @@ class DocumentDebounceManager {
|
|
|
41773
41810
|
if (this.parse_queue.length >= this.MAX_QUEUE_LENGTH) {
|
|
41774
41811
|
logger.warn(`Parse queue full, dropping ${uri} v${version}`);
|
|
41775
41812
|
this.metrics.dropped_parses++;
|
|
41776
|
-
const
|
|
41777
|
-
if (
|
|
41778
|
-
|
|
41813
|
+
const resolve15 = this.pending_resolvers.get(uri);
|
|
41814
|
+
if (resolve15) {
|
|
41815
|
+
resolve15();
|
|
41779
41816
|
this.pending_resolvers.delete(uri);
|
|
41780
41817
|
this.pending_promises.delete(uri);
|
|
41781
41818
|
}
|
|
@@ -41798,7 +41835,7 @@ class DocumentDebounceManager {
|
|
|
41798
41835
|
}
|
|
41799
41836
|
this.active_parses++;
|
|
41800
41837
|
try {
|
|
41801
|
-
await new Promise((
|
|
41838
|
+
await new Promise((resolve15) => setImmediate(resolve15));
|
|
41802
41839
|
await callback();
|
|
41803
41840
|
} catch (error) {
|
|
41804
41841
|
logger.error(`Parse error for ${uri}: ${error}`);
|
|
@@ -41830,9 +41867,9 @@ class DocumentDebounceManager {
|
|
|
41830
41867
|
clearTimeout(existing);
|
|
41831
41868
|
this.pending_timers.delete(uri);
|
|
41832
41869
|
}
|
|
41833
|
-
const
|
|
41834
|
-
if (
|
|
41835
|
-
|
|
41870
|
+
const resolve15 = this.pending_resolvers.get(uri);
|
|
41871
|
+
if (resolve15) {
|
|
41872
|
+
resolve15();
|
|
41836
41873
|
this.pending_resolvers.delete(uri);
|
|
41837
41874
|
this.pending_promises.delete(uri);
|
|
41838
41875
|
}
|
|
@@ -73804,4 +73841,4 @@ export {
|
|
|
73804
73841
|
is_cli_entry_point
|
|
73805
73842
|
};
|
|
73806
73843
|
|
|
73807
|
-
//# debugId=
|
|
73844
|
+
//# debugId=7A54D1D3B542825B64756E2164756E21
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4770f4e115de3c4df1dea43547bbf32b3d99fbc135026bedef1e73a691b47a7a sight-server.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbearak/sight",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"client"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"author": "Jonathan Marc Bearak",
|
|
63
63
|
"license": "GPL-3.0",
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@jbearak/dta-parser": "^0.
|
|
65
|
+
"@jbearak/dta-parser": "^0.6.0",
|
|
66
66
|
"picomatch": "^4.0.2",
|
|
67
67
|
"smol-toml": "^1.6.1",
|
|
68
68
|
"vscode-languageserver": "^9.0.1",
|