@jbearak/sight 0.14.3 → 0.14.5
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 +137 -85
- package/dist/sight-server.js.sha256 +1 -1
- package/package.json +1 -1
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.5",
|
|
56
56
|
type: "module",
|
|
57
57
|
workspaces: [
|
|
58
58
|
"client"
|
|
@@ -13253,6 +13253,15 @@ var init_lexer = __esm(() => {
|
|
|
13253
13253
|
ASSIGNMENT_OPERATORS = new Set(["=", "==", "!=", "<", ">", "<=", ">="]);
|
|
13254
13254
|
});
|
|
13255
13255
|
|
|
13256
|
+
// src/utils/local-macro.ts
|
|
13257
|
+
function unwrap_macval(content) {
|
|
13258
|
+
return MACVAL_LITERAL_PATTERN.exec(content)?.[1] ?? content;
|
|
13259
|
+
}
|
|
13260
|
+
var MACVAL_LITERAL_PATTERN;
|
|
13261
|
+
var init_local_macro = __esm(() => {
|
|
13262
|
+
MACVAL_LITERAL_PATTERN = /^macval\(([A-Za-z0-9_]+)\)$/;
|
|
13263
|
+
});
|
|
13264
|
+
|
|
13256
13265
|
// src/utils/continuation.ts
|
|
13257
13266
|
function is_swallowed_continuation_terminator(my_token, in_continuation) {
|
|
13258
13267
|
return my_token.type === "STATEMENT_TERMINATOR" && in_continuation && my_token.value === `
|
|
@@ -13291,6 +13300,7 @@ class ContinuationTracker {
|
|
|
13291
13300
|
var PREFIX_COMMANDS, StataParser;
|
|
13292
13301
|
var init_parser = __esm(() => {
|
|
13293
13302
|
init_types();
|
|
13303
|
+
init_local_macro();
|
|
13294
13304
|
init_file_path_utils();
|
|
13295
13305
|
PREFIX_COMMANDS = new Set(["by", "bysort", "quietly", "qui", "capture", "cap", "noisily", "noi"]);
|
|
13296
13306
|
StataParser = class StataParser {
|
|
@@ -13788,7 +13798,7 @@ var init_parser = __esm(() => {
|
|
|
13788
13798
|
}
|
|
13789
13799
|
extract_local_macro_name(value) {
|
|
13790
13800
|
if (value.startsWith("`") && value.endsWith("'")) {
|
|
13791
|
-
return value.slice(1, -1);
|
|
13801
|
+
return unwrap_macval(value.slice(1, -1));
|
|
13792
13802
|
}
|
|
13793
13803
|
return null;
|
|
13794
13804
|
}
|
|
@@ -14011,7 +14021,11 @@ var init_parser = __esm(() => {
|
|
|
14011
14021
|
const options = [];
|
|
14012
14022
|
if (this.check("COMMA")) {
|
|
14013
14023
|
this.advance();
|
|
14014
|
-
while (!this.check("STATEMENT_TERMINATOR") && !this.isAtEnd()
|
|
14024
|
+
while (!this.check("STATEMENT_TERMINATOR") && !this.isAtEnd()) {
|
|
14025
|
+
if (this.skipContinuation())
|
|
14026
|
+
continue;
|
|
14027
|
+
if (this.isTrivia())
|
|
14028
|
+
break;
|
|
14015
14029
|
if (this.check("WORD")) {
|
|
14016
14030
|
const optionToken = this.advance();
|
|
14017
14031
|
const option = {
|
|
@@ -14212,7 +14226,11 @@ var init_parser = __esm(() => {
|
|
|
14212
14226
|
const options = [];
|
|
14213
14227
|
if (this.check("COMMA")) {
|
|
14214
14228
|
this.advance();
|
|
14215
|
-
while (!this.check("STATEMENT_TERMINATOR") && !this.isAtEnd()
|
|
14229
|
+
while (!this.check("STATEMENT_TERMINATOR") && !this.isAtEnd()) {
|
|
14230
|
+
if (this.skipContinuation())
|
|
14231
|
+
continue;
|
|
14232
|
+
if (this.isTrivia())
|
|
14233
|
+
break;
|
|
14216
14234
|
if (this.check("WORD")) {
|
|
14217
14235
|
const option_token = this.advance();
|
|
14218
14236
|
const option = {
|
|
@@ -14973,7 +14991,11 @@ var init_parser = __esm(() => {
|
|
|
14973
14991
|
const options = [];
|
|
14974
14992
|
if (this.check("COMMA")) {
|
|
14975
14993
|
this.advance();
|
|
14976
|
-
while (!this.check("STATEMENT_TERMINATOR") && !this.isAtEnd()
|
|
14994
|
+
while (!this.check("STATEMENT_TERMINATOR") && !this.isAtEnd()) {
|
|
14995
|
+
if (this.skipContinuation())
|
|
14996
|
+
continue;
|
|
14997
|
+
if (this.isTrivia())
|
|
14998
|
+
break;
|
|
14977
14999
|
if (this.check("WORD")) {
|
|
14978
15000
|
const option_token = this.advance();
|
|
14979
15001
|
const option = {
|
|
@@ -19927,7 +19949,7 @@ class SemanticAnalyzer {
|
|
|
19927
19949
|
}
|
|
19928
19950
|
extract_local_macro_name(value) {
|
|
19929
19951
|
if (value.startsWith("`") && value.endsWith("'")) {
|
|
19930
|
-
return value.slice(1, -1);
|
|
19952
|
+
return unwrap_macval(value.slice(1, -1));
|
|
19931
19953
|
}
|
|
19932
19954
|
return null;
|
|
19933
19955
|
}
|
|
@@ -20020,6 +20042,7 @@ var STATA_SYSTEM_GLOBALS, WEIGHT_TYPES, STATA_STORAGE_TYPES, STR_WIDTH_RE, MATA_
|
|
|
20020
20042
|
var init_analyzer = __esm(() => {
|
|
20021
20043
|
init_scoped_locals();
|
|
20022
20044
|
init_types();
|
|
20045
|
+
init_local_macro();
|
|
20023
20046
|
init_directive_parser();
|
|
20024
20047
|
init_loop_expander();
|
|
20025
20048
|
init_macro_creating_commands();
|
|
@@ -25022,6 +25045,23 @@ var init_findalias_resolver = __esm(() => {
|
|
|
25022
25045
|
};
|
|
25023
25046
|
});
|
|
25024
25047
|
|
|
25048
|
+
// src/utils/source-discovery-policy.ts
|
|
25049
|
+
import * as path9 from "path";
|
|
25050
|
+
function is_hidden_source_path(file_path, scan_roots) {
|
|
25051
|
+
const root = get_workspace_root_for_path(scan_roots, file_path);
|
|
25052
|
+
if (!root)
|
|
25053
|
+
return false;
|
|
25054
|
+
const relative_path = path9.relative(root, path9.resolve(file_path));
|
|
25055
|
+
if (relative_path === ".." || relative_path.startsWith(`..${path9.sep}`) || path9.isAbsolute(relative_path)) {
|
|
25056
|
+
return false;
|
|
25057
|
+
}
|
|
25058
|
+
const the_directories = relative_path.split(path9.sep).slice(0, -1);
|
|
25059
|
+
return the_directories.some((my_directory) => my_directory.startsWith("."));
|
|
25060
|
+
}
|
|
25061
|
+
var init_source_discovery_policy = __esm(() => {
|
|
25062
|
+
init_workspace_roots();
|
|
25063
|
+
});
|
|
25064
|
+
|
|
25025
25065
|
// node_modules/picomatch/lib/constants.js
|
|
25026
25066
|
var require_constants = __commonJS((exports, module) => {
|
|
25027
25067
|
var WIN_SLASH = "\\\\/";
|
|
@@ -25220,8 +25260,8 @@ var require_utils = __commonJS((exports) => {
|
|
|
25220
25260
|
}
|
|
25221
25261
|
return output;
|
|
25222
25262
|
};
|
|
25223
|
-
exports.basename = (
|
|
25224
|
-
const segs =
|
|
25263
|
+
exports.basename = (path10, { windows } = {}) => {
|
|
25264
|
+
const segs = path10.split(windows ? /[\\/]/ : "/");
|
|
25225
25265
|
const last = segs[segs.length - 1];
|
|
25226
25266
|
if (last === "") {
|
|
25227
25267
|
return segs[segs.length - 2];
|
|
@@ -26702,7 +26742,7 @@ var require_picomatch2 = __commonJS((exports, module) => {
|
|
|
26702
26742
|
});
|
|
26703
26743
|
|
|
26704
26744
|
// src/utils/exclude-matcher.ts
|
|
26705
|
-
import
|
|
26745
|
+
import path10 from "path";
|
|
26706
26746
|
function normalize_pattern(raw) {
|
|
26707
26747
|
const trimmed = raw.trim();
|
|
26708
26748
|
if (trimmed === "")
|
|
@@ -26724,13 +26764,13 @@ function derive_dir_pattern(pattern) {
|
|
|
26724
26764
|
return stripped === "" ? pattern : stripped;
|
|
26725
26765
|
}
|
|
26726
26766
|
function relative_to_containing_root(abs_path, workspace_roots) {
|
|
26727
|
-
const target =
|
|
26767
|
+
const target = path10.resolve(abs_path);
|
|
26728
26768
|
let best = null;
|
|
26729
26769
|
let best_root_length = -1;
|
|
26730
26770
|
for (const my_root of workspace_roots) {
|
|
26731
|
-
const root =
|
|
26732
|
-
const my_relative =
|
|
26733
|
-
const contained = my_relative === "" || my_relative !== ".." && !my_relative.startsWith(`..${
|
|
26771
|
+
const root = path10.resolve(my_root);
|
|
26772
|
+
const my_relative = path10.relative(root, target);
|
|
26773
|
+
const contained = my_relative === "" || my_relative !== ".." && !my_relative.startsWith(`..${path10.sep}`) && !path10.isAbsolute(my_relative);
|
|
26734
26774
|
if (contained && root.length > best_root_length) {
|
|
26735
26775
|
best = my_relative;
|
|
26736
26776
|
best_root_length = root.length;
|
|
@@ -26738,7 +26778,7 @@ function relative_to_containing_root(abs_path, workspace_roots) {
|
|
|
26738
26778
|
}
|
|
26739
26779
|
if (best === null)
|
|
26740
26780
|
return null;
|
|
26741
|
-
return best.split(
|
|
26781
|
+
return best.split(path10.sep).join("/");
|
|
26742
26782
|
}
|
|
26743
26783
|
function create_exclude_matcher(patterns) {
|
|
26744
26784
|
const compiled = [];
|
|
@@ -26778,12 +26818,12 @@ function create_exclude_matcher(patterns) {
|
|
|
26778
26818
|
return {
|
|
26779
26819
|
is_empty: false,
|
|
26780
26820
|
is_excluded_file(abs_path, workspace_roots) {
|
|
26781
|
-
const
|
|
26782
|
-
if (
|
|
26821
|
+
const relative5 = relative_to_containing_root(abs_path, workspace_roots);
|
|
26822
|
+
if (relative5 === null || relative5 === "")
|
|
26783
26823
|
return false;
|
|
26784
26824
|
let excluded = false;
|
|
26785
26825
|
for (const my_rule of compiled) {
|
|
26786
|
-
if (my_rule.match(
|
|
26826
|
+
if (my_rule.match(relative5)) {
|
|
26787
26827
|
excluded = !my_rule.is_negated;
|
|
26788
26828
|
}
|
|
26789
26829
|
}
|
|
@@ -26792,8 +26832,8 @@ function create_exclude_matcher(patterns) {
|
|
|
26792
26832
|
is_excluded_dir(abs_path, workspace_roots) {
|
|
26793
26833
|
if (dir_match === null)
|
|
26794
26834
|
return false;
|
|
26795
|
-
const
|
|
26796
|
-
return
|
|
26835
|
+
const relative5 = relative_to_containing_root(abs_path, workspace_roots);
|
|
26836
|
+
return relative5 !== null && relative5 !== "" && dir_match(relative5);
|
|
26797
26837
|
}
|
|
26798
26838
|
};
|
|
26799
26839
|
}
|
|
@@ -26810,7 +26850,7 @@ var init_exclude_matcher = __esm(() => {
|
|
|
26810
26850
|
|
|
26811
26851
|
// src/indexer/index.ts
|
|
26812
26852
|
import * as fs9 from "fs";
|
|
26813
|
-
import * as
|
|
26853
|
+
import * as path11 from "path";
|
|
26814
26854
|
var MAX_PARALLEL = 4, YIELD_INTERVAL_MS = 100, INDEX_DEBOUNCE_MS = 200, WorkspaceIndexer;
|
|
26815
26855
|
var init_indexer = __esm(() => {
|
|
26816
26856
|
init_esm();
|
|
@@ -26826,6 +26866,7 @@ var init_indexer = __esm(() => {
|
|
|
26826
26866
|
init_stata_install_paths();
|
|
26827
26867
|
init_findalias_resolver();
|
|
26828
26868
|
init_file_path_utils();
|
|
26869
|
+
init_source_discovery_policy();
|
|
26829
26870
|
init_exclude_matcher();
|
|
26830
26871
|
WorkspaceIndexer = class WorkspaceIndexer {
|
|
26831
26872
|
symbol_index = new Map;
|
|
@@ -26861,6 +26902,7 @@ var init_indexer = __esm(() => {
|
|
|
26861
26902
|
is_processing_queue = false;
|
|
26862
26903
|
on_graph_change_callback;
|
|
26863
26904
|
workspace_roots = [];
|
|
26905
|
+
scan_roots = [];
|
|
26864
26906
|
scope_resolver;
|
|
26865
26907
|
scope_resolver_config = {};
|
|
26866
26908
|
set_dependency_graph(graph) {
|
|
@@ -26964,7 +27006,11 @@ var init_indexer = __esm(() => {
|
|
|
26964
27006
|
return;
|
|
26965
27007
|
}
|
|
26966
27008
|
this.ado_paths = ado_paths;
|
|
26967
|
-
this.workspace_roots = workspace_folders.map((f) =>
|
|
27009
|
+
this.workspace_roots = workspace_folders.map((f) => path11.resolve(f));
|
|
27010
|
+
this.scan_roots = [
|
|
27011
|
+
...this.workspace_roots,
|
|
27012
|
+
...ado_paths.map((my_path) => path11.resolve(my_path))
|
|
27013
|
+
];
|
|
26968
27014
|
this.help_search_paths = discover_stata_ado_paths();
|
|
26969
27015
|
const start_time = Date.now();
|
|
26970
27016
|
for (const folder of [...workspace_folders, ...this.ado_paths]) {
|
|
@@ -26996,9 +27042,9 @@ var init_indexer = __esm(() => {
|
|
|
26996
27042
|
for (const entry of entries) {
|
|
26997
27043
|
if (!this.is_active_generation(generation))
|
|
26998
27044
|
break;
|
|
26999
|
-
const entry_path =
|
|
27045
|
+
const entry_path = path11.join(dir_path, entry.name);
|
|
27000
27046
|
if (entry.isDirectory()) {
|
|
27001
|
-
if (
|
|
27047
|
+
if (entry.name.startsWith(".")) {
|
|
27002
27048
|
continue;
|
|
27003
27049
|
}
|
|
27004
27050
|
if (!this.exclude_matcher.is_empty && this.exclude_matcher.is_excluded_dir(entry_path, this.workspace_roots)) {
|
|
@@ -27028,7 +27074,7 @@ var init_indexer = __esm(() => {
|
|
|
27028
27074
|
const now = Date.now();
|
|
27029
27075
|
if (now - last_yield_time.value > YIELD_INTERVAL_MS) {
|
|
27030
27076
|
last_yield_time.value = now;
|
|
27031
|
-
await new Promise((
|
|
27077
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
27032
27078
|
}
|
|
27033
27079
|
}
|
|
27034
27080
|
};
|
|
@@ -27072,6 +27118,8 @@ var init_indexer = __esm(() => {
|
|
|
27072
27118
|
if (!this.is_active_generation(generation) || !this.enabled)
|
|
27073
27119
|
return;
|
|
27074
27120
|
const file_uri = URI.file(file_path).toString();
|
|
27121
|
+
if (is_hidden_source_path(file_path, this.scan_roots))
|
|
27122
|
+
return;
|
|
27075
27123
|
if (!this.exclude_matcher.is_empty && this.exclude_matcher.is_excluded_file(file_path, this.workspace_roots)) {
|
|
27076
27124
|
this.clear_stale_entry(file_uri);
|
|
27077
27125
|
return;
|
|
@@ -27095,7 +27143,7 @@ var init_indexer = __esm(() => {
|
|
|
27095
27143
|
return;
|
|
27096
27144
|
if (!already_indexed && this.should_skip_for_max_indexed_files(file_uri))
|
|
27097
27145
|
return;
|
|
27098
|
-
if (
|
|
27146
|
+
if (path11.extname(file_path).toLowerCase() === ".mata") {
|
|
27099
27147
|
await this.index_mata_file(content, file_uri, generation);
|
|
27100
27148
|
return;
|
|
27101
27149
|
}
|
|
@@ -27109,7 +27157,7 @@ var init_indexer = __esm(() => {
|
|
|
27109
27157
|
if (own_working_directory === undefined && this.scope_resolver) {
|
|
27110
27158
|
effective_working_directory = await this.scope_resolver.resolve_inherited_working_directory(directive_result.directives, file_uri, directive_result.standalone !== undefined, this.scope_resolver_config);
|
|
27111
27159
|
}
|
|
27112
|
-
const my_caller_dir =
|
|
27160
|
+
const my_caller_dir = path11.dirname(file_path);
|
|
27113
27161
|
const { timeline: cd_timeline } = build_cd_timeline({
|
|
27114
27162
|
starting_wd: effective_working_directory,
|
|
27115
27163
|
caller_dir: my_caller_dir,
|
|
@@ -27224,6 +27272,8 @@ var init_indexer = __esm(() => {
|
|
|
27224
27272
|
schedule_update(file_path) {
|
|
27225
27273
|
if (!this.enabled)
|
|
27226
27274
|
return;
|
|
27275
|
+
if (is_hidden_source_path(file_path, this.scan_roots))
|
|
27276
|
+
return;
|
|
27227
27277
|
const existing = this.pending_updates.get(file_path);
|
|
27228
27278
|
if (existing) {
|
|
27229
27279
|
clearTimeout(existing);
|
|
@@ -27248,7 +27298,7 @@ var init_indexer = __esm(() => {
|
|
|
27248
27298
|
break;
|
|
27249
27299
|
this.update_queue.delete(file_path);
|
|
27250
27300
|
await this.index_file(file_path, generation);
|
|
27251
|
-
await new Promise((
|
|
27301
|
+
await new Promise((resolve10) => setImmediate(resolve10));
|
|
27252
27302
|
}
|
|
27253
27303
|
} finally {
|
|
27254
27304
|
this.is_processing_queue = false;
|
|
@@ -27507,17 +27557,17 @@ var init_indexer = __esm(() => {
|
|
|
27507
27557
|
...this.help_search_paths
|
|
27508
27558
|
];
|
|
27509
27559
|
for (const my_dir of the_search_dirs) {
|
|
27510
|
-
const my_subdir_path =
|
|
27560
|
+
const my_subdir_path = path11.join(my_dir, my_first_letter, my_basename);
|
|
27511
27561
|
try {
|
|
27512
27562
|
await fs9.promises.access(my_subdir_path);
|
|
27513
27563
|
return my_subdir_path;
|
|
27514
27564
|
} catch {}
|
|
27515
|
-
const my_direct_path =
|
|
27565
|
+
const my_direct_path = path11.join(my_dir, my_basename);
|
|
27516
27566
|
try {
|
|
27517
27567
|
await fs9.promises.access(my_direct_path);
|
|
27518
27568
|
return my_direct_path;
|
|
27519
27569
|
} catch {}
|
|
27520
|
-
if (!this.workspace_roots.includes(
|
|
27570
|
+
if (!this.workspace_roots.includes(path11.resolve(my_dir))) {
|
|
27521
27571
|
continue;
|
|
27522
27572
|
}
|
|
27523
27573
|
const my_recursive_match = await this.find_sthlp_file_recursive(my_dir, my_basename);
|
|
@@ -27541,12 +27591,12 @@ var init_indexer = __esm(() => {
|
|
|
27541
27591
|
...this.help_search_paths
|
|
27542
27592
|
];
|
|
27543
27593
|
for (const my_dir of the_search_dirs) {
|
|
27544
|
-
const my_subdir_path =
|
|
27594
|
+
const my_subdir_path = path11.join(my_dir, my_first_letter, my_basename);
|
|
27545
27595
|
try {
|
|
27546
27596
|
await fs9.promises.access(my_subdir_path);
|
|
27547
27597
|
return my_subdir_path;
|
|
27548
27598
|
} catch {}
|
|
27549
|
-
const my_direct_path =
|
|
27599
|
+
const my_direct_path = path11.join(my_dir, my_basename);
|
|
27550
27600
|
try {
|
|
27551
27601
|
await fs9.promises.access(my_direct_path);
|
|
27552
27602
|
return my_direct_path;
|
|
@@ -27558,7 +27608,7 @@ var init_indexer = __esm(() => {
|
|
|
27558
27608
|
try {
|
|
27559
27609
|
const the_entries = await fs9.promises.readdir(dir);
|
|
27560
27610
|
const the_matches = the_entries.filter((my_entry) => my_entry.startsWith(prefix) && my_entry.endsWith(".sthlp")).sort();
|
|
27561
|
-
return the_matches.map((my_entry) =>
|
|
27611
|
+
return the_matches.map((my_entry) => path11.join(dir, my_entry));
|
|
27562
27612
|
} catch {
|
|
27563
27613
|
return [];
|
|
27564
27614
|
}
|
|
@@ -27582,7 +27632,7 @@ var init_indexer = __esm(() => {
|
|
|
27582
27632
|
const my_prefix = `${my_variant}_`;
|
|
27583
27633
|
const my_first_letter = my_variant.charAt(0).toLowerCase();
|
|
27584
27634
|
for (const my_dir of the_search_dirs) {
|
|
27585
|
-
const my_subdir =
|
|
27635
|
+
const my_subdir = path11.join(my_dir, my_first_letter);
|
|
27586
27636
|
const the_subdir_matches = await this.list_matching_sthlp(my_subdir, my_prefix);
|
|
27587
27637
|
for (const my_match of the_subdir_matches) {
|
|
27588
27638
|
if (!the_seen.has(my_match)) {
|
|
@@ -27627,7 +27677,7 @@ var init_indexer = __esm(() => {
|
|
|
27627
27677
|
continue;
|
|
27628
27678
|
}
|
|
27629
27679
|
for (const my_dirent of the_entries) {
|
|
27630
|
-
const my_path =
|
|
27680
|
+
const my_path = path11.join(my_entry.path, my_dirent.name);
|
|
27631
27681
|
if (my_dirent.isDirectory()) {
|
|
27632
27682
|
if (!WorkspaceIndexer.EXCLUDED_DIRS.has(my_dirent.name)) {
|
|
27633
27683
|
the_dirs.push({
|
|
@@ -27646,8 +27696,8 @@ var init_indexer = __esm(() => {
|
|
|
27646
27696
|
}
|
|
27647
27697
|
resolve_program(name, referring_uri) {
|
|
27648
27698
|
const referring_path = URI.parse(referring_uri).fsPath;
|
|
27649
|
-
const current_dir =
|
|
27650
|
-
const local_ado =
|
|
27699
|
+
const current_dir = path11.dirname(referring_path);
|
|
27700
|
+
const local_ado = path11.join(current_dir, `${name}.ado`);
|
|
27651
27701
|
if (fs9.existsSync(local_ado)) {
|
|
27652
27702
|
const local_uri = URI.file(local_ado).toString();
|
|
27653
27703
|
const entry = this.symbol_index.get(local_uri);
|
|
@@ -31448,7 +31498,7 @@ function format_help_link(topic, display) {
|
|
|
31448
31498
|
|
|
31449
31499
|
// src/providers/completion.ts
|
|
31450
31500
|
import * as fs10 from "fs";
|
|
31451
|
-
import * as
|
|
31501
|
+
import * as path12 from "path";
|
|
31452
31502
|
function coerce_macro_map(value) {
|
|
31453
31503
|
if (value instanceof Map) {
|
|
31454
31504
|
return value;
|
|
@@ -32214,7 +32264,7 @@ class CompletionProvider {
|
|
|
32214
32264
|
const path_parts = clean_path.split("/");
|
|
32215
32265
|
search_prefix = path_parts.pop() || "";
|
|
32216
32266
|
const dir_path = path_parts.join("/");
|
|
32217
|
-
base_dir =
|
|
32267
|
+
base_dir = path12.resolve(workspace_root, dir_path);
|
|
32218
32268
|
} else {
|
|
32219
32269
|
search_prefix = clean_path;
|
|
32220
32270
|
}
|
|
@@ -32230,7 +32280,7 @@ class CompletionProvider {
|
|
|
32230
32280
|
if (search_prefix && !entry.name.toLowerCase().startsWith(search_prefix.toLowerCase())) {
|
|
32231
32281
|
continue;
|
|
32232
32282
|
}
|
|
32233
|
-
const entry_kind = classify_entry_sync(entry,
|
|
32283
|
+
const entry_kind = classify_entry_sync(entry, path12.join(base_dir, entry.name), fs10);
|
|
32234
32284
|
if (entry_kind === "directory") {
|
|
32235
32285
|
completions.push({
|
|
32236
32286
|
label: entry.name + "/",
|
|
@@ -32258,17 +32308,17 @@ class CompletionProvider {
|
|
|
32258
32308
|
get_workspace_root(document_uri) {
|
|
32259
32309
|
try {
|
|
32260
32310
|
const file_path = document_uri.replace(/^file:\/\//, "");
|
|
32261
|
-
let current_dir =
|
|
32262
|
-
while (current_dir !==
|
|
32311
|
+
let current_dir = path12.dirname(file_path);
|
|
32312
|
+
while (current_dir !== path12.dirname(current_dir)) {
|
|
32263
32313
|
const markers = [".git", "sight.toml", ".sight.json", "package.json", ".vscode"];
|
|
32264
32314
|
for (const marker of markers) {
|
|
32265
|
-
if (fs10.existsSync(
|
|
32315
|
+
if (fs10.existsSync(path12.join(current_dir, marker))) {
|
|
32266
32316
|
return current_dir;
|
|
32267
32317
|
}
|
|
32268
32318
|
}
|
|
32269
|
-
current_dir =
|
|
32319
|
+
current_dir = path12.dirname(current_dir);
|
|
32270
32320
|
}
|
|
32271
|
-
return
|
|
32321
|
+
return path12.dirname(file_path);
|
|
32272
32322
|
} catch {
|
|
32273
32323
|
return null;
|
|
32274
32324
|
}
|
|
@@ -33753,7 +33803,7 @@ function create_shutdown_handler(deps, disposables) {
|
|
|
33753
33803
|
const SHUTDOWN_TIMEOUT_MS = 500;
|
|
33754
33804
|
await Promise.race([
|
|
33755
33805
|
deps.document_store.dispose(),
|
|
33756
|
-
new Promise((
|
|
33806
|
+
new Promise((resolve11) => setTimeout(resolve11, SHUTDOWN_TIMEOUT_MS))
|
|
33757
33807
|
]);
|
|
33758
33808
|
}
|
|
33759
33809
|
deps?.scope_resolver?.dispose();
|
|
@@ -34508,26 +34558,26 @@ var init_shared = __esm(() => {
|
|
|
34508
34558
|
|
|
34509
34559
|
// src/cli/source-files.ts
|
|
34510
34560
|
import * as fs12 from "fs";
|
|
34511
|
-
import * as
|
|
34561
|
+
import * as path13 from "path";
|
|
34512
34562
|
import { TextDecoder } from "util";
|
|
34513
34563
|
function canonicalize_existing_path(file_path) {
|
|
34514
34564
|
return fs12.realpathSync.native(file_path);
|
|
34515
34565
|
}
|
|
34516
34566
|
function workspace_relative(workspace_root, file_path) {
|
|
34517
|
-
const
|
|
34518
|
-
const inside =
|
|
34519
|
-
return { relative:
|
|
34567
|
+
const relative6 = path13.relative(workspace_root, file_path);
|
|
34568
|
+
const inside = relative6 !== ".." && !relative6.startsWith(`..${path13.sep}`) && !path13.isAbsolute(relative6);
|
|
34569
|
+
return { relative: relative6, inside };
|
|
34520
34570
|
}
|
|
34521
34571
|
function relative_path(workspace_root, file_path) {
|
|
34522
|
-
const { relative:
|
|
34523
|
-
if (
|
|
34572
|
+
const { relative: relative6 } = workspace_relative(workspace_root, file_path);
|
|
34573
|
+
if (relative6 === "") {
|
|
34524
34574
|
return ".";
|
|
34525
34575
|
}
|
|
34526
|
-
return
|
|
34576
|
+
return path13.isAbsolute(relative6) ? file_path : relative6.split(path13.sep).join("/");
|
|
34527
34577
|
}
|
|
34528
34578
|
function is_within_workspace(workspace_root, file_path) {
|
|
34529
|
-
const { relative:
|
|
34530
|
-
return
|
|
34579
|
+
const { relative: relative6, inside } = workspace_relative(workspace_root, file_path);
|
|
34580
|
+
return relative6 === "" || relative6.length > 0 && inside;
|
|
34531
34581
|
}
|
|
34532
34582
|
function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_matcher) {
|
|
34533
34583
|
let entries;
|
|
@@ -34538,9 +34588,9 @@ function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_m
|
|
|
34538
34588
|
return;
|
|
34539
34589
|
}
|
|
34540
34590
|
for (const entry of entries) {
|
|
34541
|
-
const entry_path =
|
|
34591
|
+
const entry_path = path13.join(dir_path, entry.name);
|
|
34542
34592
|
if (entry.isDirectory()) {
|
|
34543
|
-
if (
|
|
34593
|
+
if (entry.name.startsWith("."))
|
|
34544
34594
|
continue;
|
|
34545
34595
|
if (!exclude_matcher.is_empty && exclude_matcher.is_excluded_dir(entry_path, workspace_roots)) {
|
|
34546
34596
|
continue;
|
|
@@ -34557,7 +34607,7 @@ function walk_sources(dir_path, out, operator_errors, workspace_roots, exclude_m
|
|
|
34557
34607
|
function collect_report_targets(input_paths, workspace_root, cwd, exclude_patterns = []) {
|
|
34558
34608
|
const operator_errors = [];
|
|
34559
34609
|
const source_paths = [];
|
|
34560
|
-
let normalized_root =
|
|
34610
|
+
let normalized_root = path13.resolve(workspace_root);
|
|
34561
34611
|
try {
|
|
34562
34612
|
normalized_root = canonicalize_existing_path(normalized_root);
|
|
34563
34613
|
} catch {}
|
|
@@ -34566,7 +34616,7 @@ function collect_report_targets(input_paths, workspace_root, cwd, exclude_patter
|
|
|
34566
34616
|
const has_explicit_paths = input_paths.length > 0;
|
|
34567
34617
|
const paths_to_collect = input_paths.length > 0 ? input_paths : [normalized_root];
|
|
34568
34618
|
for (const input_path of paths_to_collect) {
|
|
34569
|
-
const resolved_path =
|
|
34619
|
+
const resolved_path = path13.resolve(cwd, input_path);
|
|
34570
34620
|
if (!fs12.existsSync(resolved_path)) {
|
|
34571
34621
|
operator_errors.push(`path does not exist: ${input_path}`);
|
|
34572
34622
|
continue;
|
|
@@ -34714,7 +34764,7 @@ __export(exports_check, {
|
|
|
34714
34764
|
build_check_context: () => build_check_context
|
|
34715
34765
|
});
|
|
34716
34766
|
import * as fs13 from "fs";
|
|
34717
|
-
import * as
|
|
34767
|
+
import * as path14 from "path";
|
|
34718
34768
|
function parse_required_option_value(argv, index, flag, value_kind, inline_value) {
|
|
34719
34769
|
if (inline_value !== undefined) {
|
|
34720
34770
|
if (inline_value.length === 0) {
|
|
@@ -34880,7 +34930,7 @@ function load_check_config(options) {
|
|
|
34880
34930
|
warnings: validation_warnings
|
|
34881
34931
|
};
|
|
34882
34932
|
}
|
|
34883
|
-
const loaded = options.config_path ? load_toml_file(
|
|
34933
|
+
const loaded = options.config_path ? load_toml_file(path14.resolve(options.cwd, options.config_path)) : discover_and_load_project_config(options.workspace_root);
|
|
34884
34934
|
if (loaded.kind === "load-failed") {
|
|
34885
34935
|
return {
|
|
34886
34936
|
kind: "operator-error",
|
|
@@ -34969,6 +35019,7 @@ async function collect_check_diagnostics(context, workspace_root, config, target
|
|
|
34969
35019
|
const workspace_symbols = context.workspace_indexer.get_all_symbols();
|
|
34970
35020
|
const files_indexed = context.workspace_indexer.get_metrics().files_indexed;
|
|
34971
35021
|
const exclude_matcher = create_exclude_matcher(config.exclude);
|
|
35022
|
+
const scan_roots = [workspace_root, ...config.adoPaths];
|
|
34972
35023
|
const the_slots = new Array(targets.length);
|
|
34973
35024
|
async function collect_target_diagnostics(target, document_store) {
|
|
34974
35025
|
const records = [];
|
|
@@ -34986,7 +35037,7 @@ async function collect_check_diagnostics(context, workspace_root, config, target
|
|
|
34986
35037
|
}
|
|
34987
35038
|
return records;
|
|
34988
35039
|
}
|
|
34989
|
-
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])) {
|
|
35040
|
+
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])) {
|
|
34990
35041
|
records.push(diagnostic_record(target.relative_path, index_limit_diagnostic()));
|
|
34991
35042
|
return records;
|
|
34992
35043
|
}
|
|
@@ -35070,7 +35121,7 @@ async function run_check_with_cwd(argv, cwd, output = DEFAULT_OUTPUT) {
|
|
|
35070
35121
|
`);
|
|
35071
35122
|
return EXIT_OK;
|
|
35072
35123
|
}
|
|
35073
|
-
const resolved_workspace_root =
|
|
35124
|
+
const resolved_workspace_root = path14.resolve(cwd, result.args.workspace ?? ".");
|
|
35074
35125
|
let is_workspace_directory = false;
|
|
35075
35126
|
try {
|
|
35076
35127
|
is_workspace_directory = fs13.statSync(resolved_workspace_root).isDirectory();
|
|
@@ -35158,6 +35209,7 @@ var init_check = __esm(() => {
|
|
|
35158
35209
|
init_logger();
|
|
35159
35210
|
init_source_files();
|
|
35160
35211
|
init_exclude_matcher();
|
|
35212
|
+
init_source_discovery_policy();
|
|
35161
35213
|
init_shared();
|
|
35162
35214
|
DEFAULT_OUTPUT = {
|
|
35163
35215
|
stdout: (text) => process.stdout.write(text),
|
|
@@ -35433,7 +35485,7 @@ function is_position_in_range3(position, range) {
|
|
|
35433
35485
|
}
|
|
35434
35486
|
|
|
35435
35487
|
// src/providers/hover.ts
|
|
35436
|
-
import * as
|
|
35488
|
+
import * as path15 from "path";
|
|
35437
35489
|
function has_definition_index(hit) {
|
|
35438
35490
|
return typeof hit.definition_index === "number";
|
|
35439
35491
|
}
|
|
@@ -36783,7 +36835,7 @@ ${source_info}${footer}`
|
|
|
36783
36835
|
if (this.looks_like_uri_scheme(uri_or_path)) {
|
|
36784
36836
|
return null;
|
|
36785
36837
|
}
|
|
36786
|
-
return
|
|
36838
|
+
return path15.resolve(uri_or_path);
|
|
36787
36839
|
}
|
|
36788
36840
|
escape_markdown_link_text(text) {
|
|
36789
36841
|
return text.replace(/[\\[\]()]/g, "\\$&");
|
|
@@ -36803,11 +36855,11 @@ ${source_info}${footer}`
|
|
|
36803
36855
|
if (workspace_fs_path === null) {
|
|
36804
36856
|
return fs_path;
|
|
36805
36857
|
}
|
|
36806
|
-
const
|
|
36807
|
-
if (
|
|
36858
|
+
const relative7 = path15.relative(workspace_fs_path, fs_path);
|
|
36859
|
+
if (relative7.startsWith("..") || path15.isAbsolute(relative7)) {
|
|
36808
36860
|
return fs_path;
|
|
36809
36861
|
}
|
|
36810
|
-
return
|
|
36862
|
+
return relative7;
|
|
36811
36863
|
}
|
|
36812
36864
|
format_source_link(source_uri, current_uri, workspace_root) {
|
|
36813
36865
|
const source_path = this.normalize_file_path(source_uri);
|
|
@@ -37158,7 +37210,7 @@ var init_hover = __esm(() => {
|
|
|
37158
37210
|
});
|
|
37159
37211
|
|
|
37160
37212
|
// src/providers/definition.ts
|
|
37161
|
-
import * as
|
|
37213
|
+
import * as path16 from "path";
|
|
37162
37214
|
|
|
37163
37215
|
class DefinitionProvider {
|
|
37164
37216
|
workspace_roots = [];
|
|
@@ -37903,7 +37955,7 @@ class DefinitionProvider {
|
|
|
37903
37955
|
if (!the_call) {
|
|
37904
37956
|
return { matched: false, path: null };
|
|
37905
37957
|
}
|
|
37906
|
-
const current_dir =
|
|
37958
|
+
const current_dir = path16.dirname(URI.parse(document.uri).fsPath);
|
|
37907
37959
|
const my_outcome = resolve_forward_call_rich(file_path, current_dir, the_call.working_directory, { workspace_roots: this.workspace_roots });
|
|
37908
37960
|
if (my_outcome.kind === "exact" || my_outcome.kind === "case_only") {
|
|
37909
37961
|
return { matched: true, path: my_outcome.path };
|
|
@@ -37912,8 +37964,8 @@ class DefinitionProvider {
|
|
|
37912
37964
|
}
|
|
37913
37965
|
resolve_file_path(current_uri, file_path) {
|
|
37914
37966
|
const current_path = URI.parse(current_uri).fsPath;
|
|
37915
|
-
const current_dir =
|
|
37916
|
-
const resolved_path =
|
|
37967
|
+
const current_dir = path16.dirname(current_path);
|
|
37968
|
+
const resolved_path = path16.resolve(current_dir, file_path);
|
|
37917
37969
|
const the_roots_set = new Set(this.workspace_roots);
|
|
37918
37970
|
the_roots_set.add(current_dir);
|
|
37919
37971
|
const the_roots = Array.from(the_roots_set);
|
|
@@ -38487,7 +38539,7 @@ class ReferencesProvider {
|
|
|
38487
38539
|
}
|
|
38488
38540
|
file_count++;
|
|
38489
38541
|
if (file_count % 10 === 0) {
|
|
38490
|
-
await new Promise((
|
|
38542
|
+
await new Promise((resolve15) => setTimeout(resolve15, 0));
|
|
38491
38543
|
if (cancellation_token?.isCancellationRequested) {
|
|
38492
38544
|
break;
|
|
38493
38545
|
}
|
|
@@ -38913,7 +38965,7 @@ var init_section_detector = __esm(() => {
|
|
|
38913
38965
|
});
|
|
38914
38966
|
|
|
38915
38967
|
// src/providers/symbols.ts
|
|
38916
|
-
import * as
|
|
38968
|
+
import * as path17 from "path";
|
|
38917
38969
|
function is_position_in_range4(position, range) {
|
|
38918
38970
|
if (position.line < range.start.line) {
|
|
38919
38971
|
return false;
|
|
@@ -39309,7 +39361,7 @@ class SymbolProvider {
|
|
|
39309
39361
|
}
|
|
39310
39362
|
}
|
|
39311
39363
|
for (const document of all_documents) {
|
|
39312
|
-
const my_basename =
|
|
39364
|
+
const my_basename = path17.basename(document.uri);
|
|
39313
39365
|
for (const my_program of document.symbols.programs.values()) {
|
|
39314
39366
|
if (my_program.name.toLowerCase().includes(lower_query)) {
|
|
39315
39367
|
symbols.push({
|
|
@@ -41754,8 +41806,8 @@ class DocumentDebounceManager {
|
|
|
41754
41806
|
if (prev_resolver) {
|
|
41755
41807
|
prev_resolver();
|
|
41756
41808
|
}
|
|
41757
|
-
const promise = new Promise((
|
|
41758
|
-
this.pending_resolvers.set(uri,
|
|
41809
|
+
const promise = new Promise((resolve15) => {
|
|
41810
|
+
this.pending_resolvers.set(uri, resolve15);
|
|
41759
41811
|
});
|
|
41760
41812
|
this.pending_promises.set(uri, promise);
|
|
41761
41813
|
const timer = setTimeout(() => {
|
|
@@ -41781,9 +41833,9 @@ class DocumentDebounceManager {
|
|
|
41781
41833
|
if (this.parse_queue.length >= this.MAX_QUEUE_LENGTH) {
|
|
41782
41834
|
logger.warn(`Parse queue full, dropping ${uri} v${version}`);
|
|
41783
41835
|
this.metrics.dropped_parses++;
|
|
41784
|
-
const
|
|
41785
|
-
if (
|
|
41786
|
-
|
|
41836
|
+
const resolve15 = this.pending_resolvers.get(uri);
|
|
41837
|
+
if (resolve15) {
|
|
41838
|
+
resolve15();
|
|
41787
41839
|
this.pending_resolvers.delete(uri);
|
|
41788
41840
|
this.pending_promises.delete(uri);
|
|
41789
41841
|
}
|
|
@@ -41806,7 +41858,7 @@ class DocumentDebounceManager {
|
|
|
41806
41858
|
}
|
|
41807
41859
|
this.active_parses++;
|
|
41808
41860
|
try {
|
|
41809
|
-
await new Promise((
|
|
41861
|
+
await new Promise((resolve15) => setImmediate(resolve15));
|
|
41810
41862
|
await callback();
|
|
41811
41863
|
} catch (error) {
|
|
41812
41864
|
logger.error(`Parse error for ${uri}: ${error}`);
|
|
@@ -41838,9 +41890,9 @@ class DocumentDebounceManager {
|
|
|
41838
41890
|
clearTimeout(existing);
|
|
41839
41891
|
this.pending_timers.delete(uri);
|
|
41840
41892
|
}
|
|
41841
|
-
const
|
|
41842
|
-
if (
|
|
41843
|
-
|
|
41893
|
+
const resolve15 = this.pending_resolvers.get(uri);
|
|
41894
|
+
if (resolve15) {
|
|
41895
|
+
resolve15();
|
|
41844
41896
|
this.pending_resolvers.delete(uri);
|
|
41845
41897
|
this.pending_promises.delete(uri);
|
|
41846
41898
|
}
|
|
@@ -73812,4 +73864,4 @@ export {
|
|
|
73812
73864
|
is_cli_entry_point
|
|
73813
73865
|
};
|
|
73814
73866
|
|
|
73815
|
-
//# debugId=
|
|
73867
|
+
//# debugId=19E8989026935ECD64756E2164756E21
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
861c239888154dd8cbe21fadf25874416280e17b2bb9fbf2080e8dd4a63dbbfc sight-server.js
|