@jbearak/sight 0.14.1 → 0.14.3

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.
@@ -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.1",
55
+ version: "0.14.3",
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.3.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
  }
@@ -17334,6 +17342,9 @@ function inline_embedded_statement_end(tokens, opener_index) {
17334
17342
  const end_index = my_i < tokens.length && tokens[my_i].type === "STATEMENT_TERMINATOR" ? my_i : my_last_content_index;
17335
17343
  return { end_index, end_line };
17336
17344
  }
17345
+ function is_logical_statement_boundary(my_token) {
17346
+ return LOGICAL_BOUNDARY_TYPES.has(my_token.type);
17347
+ }
17337
17348
  function logical_statement_start(tokens, position, min_line = 0) {
17338
17349
  if (tokens === undefined || tokens.length === 0) {
17339
17350
  return;
@@ -17358,7 +17369,7 @@ function logical_statement_start(tokens, position, min_line = 0) {
17358
17369
  if (is_swallowed_continuation_terminator(my_token, my_i > 0 && tokens[my_i - 1].type === "CONTINUATION")) {
17359
17370
  continue;
17360
17371
  }
17361
- if (LOGICAL_BOUNDARY_TYPES.has(my_token.type)) {
17372
+ if (is_logical_statement_boundary(my_token)) {
17362
17373
  boundary_index = my_i;
17363
17374
  break;
17364
17375
  }
@@ -28281,6 +28292,236 @@ var init_diagnostic_token_stream = __esm(() => {
28281
28292
  function is_invalid_operator_sequence_pair(first_value, second_value) {
28282
28293
  return INVALID_PAIRS.has(`${first_value} ${second_value}`);
28283
28294
  }
28295
+ function resolve_mixed_effects_command_head(the_significant, statement_start, statement_end) {
28296
+ let my_i = statement_start;
28297
+ while (my_i < statement_end) {
28298
+ const my_prefix = the_significant[my_i];
28299
+ if (my_prefix.type !== "WORD") {
28300
+ break;
28301
+ }
28302
+ if (MIXED_COLON_OPTIONAL_PREFIX_COMMANDS.has(my_prefix.value)) {
28303
+ my_i++;
28304
+ if (my_i < statement_end && the_significant[my_i].type === "COLON") {
28305
+ my_i++;
28306
+ }
28307
+ continue;
28308
+ }
28309
+ if (MIXED_COLON_REQUIRED_PREFIX_COMMANDS.has(my_prefix.value) && my_i + 1 < statement_end && the_significant[my_i + 1].type === "COLON") {
28310
+ my_i += 2;
28311
+ continue;
28312
+ }
28313
+ break;
28314
+ }
28315
+ const my_command = the_significant[my_i];
28316
+ if (my_i >= statement_end || my_command?.type !== "WORD") {
28317
+ return;
28318
+ }
28319
+ const my_continuation = the_significant[my_i + 1];
28320
+ if (my_i + 1 < statement_end && is_name_continuation_fragment(my_continuation) && is_adjacent(my_command, my_continuation)) {
28321
+ return;
28322
+ }
28323
+ return { token: my_command, index: my_i };
28324
+ }
28325
+ function is_matching_group_close(my_opener, close_type) {
28326
+ return my_opener === "LPAREN" && close_type === "RPAREN" || my_opener === "LBRACKET" && close_type === "RBRACKET";
28327
+ }
28328
+ function is_name_fragment(my_token) {
28329
+ return my_token !== undefined && NAME_FRAGMENT_TOKEN_TYPES.has(my_token.type);
28330
+ }
28331
+ function is_name_continuation_fragment(my_token) {
28332
+ return my_token !== undefined && NAME_CONTINUATION_TOKEN_TYPES.has(my_token.type);
28333
+ }
28334
+ function is_plausible_model_head(the_significant, model_head_index, statement_end) {
28335
+ const my_head = the_significant[model_head_index];
28336
+ if (is_mixed_varlist_wildcard(my_head)) {
28337
+ return true;
28338
+ }
28339
+ if (!is_name_fragment(my_head)) {
28340
+ return false;
28341
+ }
28342
+ if (my_head.type !== "WORD" || my_head.value !== "if" && my_head.value !== "in") {
28343
+ return true;
28344
+ }
28345
+ const my_continuation = the_significant[model_head_index + 1];
28346
+ return model_head_index + 1 < statement_end && is_name_continuation_fragment(my_continuation) && is_adjacent(my_head, my_continuation);
28347
+ }
28348
+ function is_mixed_varlist_wildcard(my_token) {
28349
+ return my_token?.type === "OPERATOR" && my_token.value === "*" || (my_token?.type === "OPERATOR" || my_token?.type === "WORD") && my_token.value === "?";
28350
+ }
28351
+ function is_mixed_constructed_name_fragment(my_token) {
28352
+ return is_name_continuation_fragment(my_token) || is_mixed_varlist_wildcard(my_token);
28353
+ }
28354
+ function is_standalone_mixed_qualifier(the_significant, token_index) {
28355
+ const my_token = the_significant[token_index];
28356
+ if (my_token.type !== "WORD" || my_token.value !== "if" && my_token.value !== "in") {
28357
+ return false;
28358
+ }
28359
+ const my_previous = the_significant[token_index - 1];
28360
+ const my_next = the_significant[token_index + 1];
28361
+ return !(is_mixed_constructed_name_fragment(my_previous) && is_adjacent(my_previous, my_token) || is_mixed_constructed_name_fragment(my_next) && is_adjacent(my_token, my_next));
28362
+ }
28363
+ function is_plausible_mixed_varlist_range_dash(the_significant, dash_index) {
28364
+ const my_dash = the_significant[dash_index];
28365
+ const my_right_fragment = the_significant[dash_index + 1];
28366
+ if (my_dash.type !== "OPERATOR" || my_dash.value !== "-" || !is_name_fragment(my_right_fragment) || !is_adjacent(my_dash, my_right_fragment)) {
28367
+ return false;
28368
+ }
28369
+ let my_right_boundary = my_dash;
28370
+ for (let my_i = dash_index - 1;my_i >= 0; my_i--) {
28371
+ const my_left_fragment = the_significant[my_i];
28372
+ if (!is_name_continuation_fragment(my_left_fragment) || !is_adjacent(my_left_fragment, my_right_boundary)) {
28373
+ return false;
28374
+ }
28375
+ if (is_name_fragment(my_left_fragment)) {
28376
+ return true;
28377
+ }
28378
+ my_right_boundary = my_left_fragment;
28379
+ }
28380
+ return false;
28381
+ }
28382
+ function has_dangling_operator_before_mixed_separator(the_significant, first_bar_index, mixed_varlist_is_open) {
28383
+ const my_previous = the_significant[first_bar_index - 1];
28384
+ if (!is_mixed_varlist_wildcard(my_previous)) {
28385
+ return my_previous?.type === "OPERATOR";
28386
+ }
28387
+ if (!mixed_varlist_is_open) {
28388
+ return true;
28389
+ }
28390
+ let my_i = first_bar_index - 2;
28391
+ while (is_mixed_varlist_wildcard(the_significant[my_i])) {
28392
+ my_i--;
28393
+ }
28394
+ return the_significant[my_i]?.type === "OPERATOR";
28395
+ }
28396
+ function plausible_levelvar_colon_index(the_significant, first_bar_index, statement_end) {
28397
+ const my_first_fragment_index = first_bar_index + 2;
28398
+ const my_first_fragment = the_significant[my_first_fragment_index];
28399
+ if (!is_name_fragment(my_first_fragment)) {
28400
+ return;
28401
+ }
28402
+ let my_fragment_count = 1;
28403
+ let my_last_fragment_index = my_first_fragment_index;
28404
+ while (my_last_fragment_index + 1 < statement_end) {
28405
+ const my_last_fragment = the_significant[my_last_fragment_index];
28406
+ const my_next_fragment = the_significant[my_last_fragment_index + 1];
28407
+ if (!is_name_continuation_fragment(my_next_fragment) || !is_adjacent(my_last_fragment, my_next_fragment)) {
28408
+ break;
28409
+ }
28410
+ my_fragment_count++;
28411
+ my_last_fragment_index++;
28412
+ }
28413
+ const my_colon_index = my_last_fragment_index + 1;
28414
+ const my_colon = the_significant[my_colon_index];
28415
+ if (my_colon?.type !== "COLON") {
28416
+ return;
28417
+ }
28418
+ if (my_fragment_count === 1 && my_first_fragment.type === "WORD" && (my_first_fragment.value === "if" || my_first_fragment.value === "in")) {
28419
+ return;
28420
+ }
28421
+ return my_colon_index;
28422
+ }
28423
+ function mark_mixed_effects_separators_in_statement(the_significant, statement_start, statement_end, the_separator_starts) {
28424
+ const my_command_head = resolve_mixed_effects_command_head(the_significant, statement_start, statement_end);
28425
+ if (my_command_head === undefined || !MIXED_EFFECTS_SEPARATOR_COMMANDS.has(my_command_head.token.value)) {
28426
+ return;
28427
+ }
28428
+ const my_group_stack = [];
28429
+ const my_has_required_model_content = OMITTED_MODEL_HEAD_COMMANDS.has(my_command_head.token.value) || is_plausible_model_head(the_significant, my_command_head.index + 1, statement_end);
28430
+ let my_saw_top_level_options_comma = false;
28431
+ let my_saw_top_level_double_bar = false;
28432
+ let my_has_marked_separator = false;
28433
+ let my_separators_are_valid = true;
28434
+ let my_mixed_varlist_is_open = true;
28435
+ for (let my_i = my_command_head.index + 1;my_i < statement_end; my_i++) {
28436
+ const my_token = the_significant[my_i];
28437
+ if (my_token.type === "LPAREN" || my_token.type === "LBRACKET") {
28438
+ my_group_stack.push(my_token.type);
28439
+ continue;
28440
+ }
28441
+ if (my_token.type === "RPAREN" || my_token.type === "RBRACKET") {
28442
+ if (!is_matching_group_close(my_group_stack[my_group_stack.length - 1], my_token.type)) {
28443
+ break;
28444
+ }
28445
+ my_group_stack.pop();
28446
+ continue;
28447
+ }
28448
+ if (my_group_stack.length !== 0) {
28449
+ continue;
28450
+ }
28451
+ if (my_token.type === "COMMA") {
28452
+ if (!my_has_marked_separator) {
28453
+ my_saw_top_level_options_comma = true;
28454
+ }
28455
+ my_mixed_varlist_is_open = false;
28456
+ continue;
28457
+ }
28458
+ if (is_standalone_mixed_qualifier(the_significant, my_i)) {
28459
+ my_mixed_varlist_is_open = false;
28460
+ }
28461
+ const my_second_bar = the_significant[my_i + 1];
28462
+ if (my_token.type !== "OPERATOR" || my_token.value !== "|" || my_second_bar?.type !== "OPERATOR" || my_second_bar.value !== "|" || !is_adjacent(my_token, my_second_bar)) {
28463
+ if (my_token.type === "OPERATOR" && !is_mixed_varlist_wildcard(my_token) && !(my_mixed_varlist_is_open && is_plausible_mixed_varlist_range_dash(the_significant, my_i))) {
28464
+ my_mixed_varlist_is_open = false;
28465
+ }
28466
+ continue;
28467
+ }
28468
+ if (!my_saw_top_level_double_bar) {
28469
+ my_saw_top_level_double_bar = true;
28470
+ if (!my_has_required_model_content) {
28471
+ my_separators_are_valid = false;
28472
+ }
28473
+ }
28474
+ const my_levelvar_colon_index = plausible_levelvar_colon_index(the_significant, my_i, statement_end);
28475
+ if (!my_separators_are_valid || !my_has_marked_separator && my_saw_top_level_options_comma || has_dangling_operator_before_mixed_separator(the_significant, my_i, my_mixed_varlist_is_open) || my_levelvar_colon_index === undefined) {
28476
+ my_mixed_varlist_is_open = false;
28477
+ continue;
28478
+ }
28479
+ the_separator_starts.add(my_token);
28480
+ my_has_marked_separator = true;
28481
+ my_mixed_varlist_is_open = true;
28482
+ my_i = my_levelvar_colon_index;
28483
+ }
28484
+ }
28485
+ function file_mentions_mixed_effects_command(tokens) {
28486
+ for (const my_token of tokens) {
28487
+ if (my_token.type === "WORD" && MIXED_EFFECTS_SEPARATOR_COMMANDS.has(my_token.value)) {
28488
+ return true;
28489
+ }
28490
+ }
28491
+ return false;
28492
+ }
28493
+ function collect_mixed_effects_separator_starts(tokens) {
28494
+ const my_memoized = mixed_effects_separator_starts_memo.get(tokens);
28495
+ if (my_memoized !== undefined) {
28496
+ return my_memoized;
28497
+ }
28498
+ const the_separator_starts = compute_mixed_effects_separator_starts(tokens);
28499
+ mixed_effects_separator_starts_memo.set(tokens, the_separator_starts);
28500
+ return the_separator_starts;
28501
+ }
28502
+ function compute_mixed_effects_separator_starts(tokens) {
28503
+ if (!file_mentions_mixed_effects_command(tokens)) {
28504
+ return new Set;
28505
+ }
28506
+ const the_significant = collect_significant_tokens(tokens);
28507
+ const the_separator_starts = new Set;
28508
+ let statement_start = 0;
28509
+ for (let my_i = 0;my_i <= the_significant.length; my_i++) {
28510
+ const my_token = the_significant[my_i];
28511
+ const at_end = my_token === undefined || my_token.type === "EOF";
28512
+ if (!at_end && !is_logical_statement_boundary(my_token)) {
28513
+ continue;
28514
+ }
28515
+ if (statement_start < my_i) {
28516
+ mark_mixed_effects_separators_in_statement(the_significant, statement_start, my_i, the_separator_starts);
28517
+ }
28518
+ if (at_end) {
28519
+ break;
28520
+ }
28521
+ statement_start = my_i + 1;
28522
+ }
28523
+ return the_separator_starts;
28524
+ }
28284
28525
 
28285
28526
  class OperatorSequenceAnalyzer {
28286
28527
  analyze(document, config) {
@@ -28297,6 +28538,7 @@ class OperatorSequenceAnalyzer {
28297
28538
  }
28298
28539
  const ignored_lines = document.ignored_lines ?? new Set;
28299
28540
  const ast = document.ast;
28541
+ const the_mixed_effects_separator_starts = collect_mixed_effects_separator_starts(the_tokens);
28300
28542
  const the_diagnostics = [];
28301
28543
  let i = 0;
28302
28544
  while (i < the_tokens.length) {
@@ -28311,6 +28553,10 @@ class OperatorSequenceAnalyzer {
28311
28553
  continue;
28312
28554
  }
28313
28555
  const { second_token, next_index } = adjacency_result;
28556
+ if (the_mixed_effects_separator_starts.has(first_token)) {
28557
+ i = next_index;
28558
+ continue;
28559
+ }
28314
28560
  const pair_result = this.classify_pair(first_token, second_token, ast ?? undefined);
28315
28561
  if (!pair_result) {
28316
28562
  i++;
@@ -28559,11 +28805,12 @@ class OperatorSequenceAnalyzer {
28559
28805
  return resolve_diagnostic_severity(config_severity, default_severity);
28560
28806
  }
28561
28807
  }
28562
- var import_node3, SPACED_COMPOUND_PAIRS, MALFORMED_OPERATOR_PAIRS, INVALID_PAIRS, CSTYLE_LOGICAL_PAIRS, SPECIAL_MESSAGES, CSTYLE_QUALIFIER_MESSAGES, CSTYLE_CONTROL_FLOW_MESSAGES, ARITHMETIC_OPS, COMPARISON_OPS, NEGATION_OPS, TRIVIA_TYPES, ADJACENCY_BREAKERS;
28808
+ var import_node3, SPACED_COMPOUND_PAIRS, MALFORMED_OPERATOR_PAIRS, INVALID_PAIRS, CSTYLE_LOGICAL_PAIRS, SPECIAL_MESSAGES, CSTYLE_QUALIFIER_MESSAGES, CSTYLE_CONTROL_FLOW_MESSAGES, ARITHMETIC_OPS, COMPARISON_OPS, NEGATION_OPS, TRIVIA_TYPES, ADJACENCY_BREAKERS, MIXED_EFFECTS_SEPARATOR_COMMANDS, OMITTED_MODEL_HEAD_COMMANDS, MIXED_COLON_OPTIONAL_PREFIX_COMMANDS, MIXED_COLON_REQUIRED_PREFIX_COMMANDS, NAME_FRAGMENT_TOKEN_TYPES, NAME_CONTINUATION_TOKEN_TYPES, mixed_effects_separator_starts_memo;
28563
28809
  var init_operator_sequence_diagnostics = __esm(() => {
28564
28810
  init_types();
28565
28811
  init_diagnostic_code_description();
28566
28812
  init_diagnostic_severity();
28813
+ init_statement_span();
28567
28814
  init_diagnostic_token_stream();
28568
28815
  import_node3 = __toESM(require_main4(), 1);
28569
28816
  SPACED_COMPOUND_PAIRS = new Map([
@@ -28619,6 +28866,58 @@ var init_operator_sequence_diagnostics = __esm(() => {
28619
28866
  ADJACENCY_BREAKERS = new Set([
28620
28867
  "STATEMENT_TERMINATOR"
28621
28868
  ]);
28869
+ MIXED_EFFECTS_SEPARATOR_COMMANDS = new Set([
28870
+ "mixed",
28871
+ "mecloglog",
28872
+ "meglm",
28873
+ "meintreg",
28874
+ "melogit",
28875
+ "menbreg",
28876
+ "meologit",
28877
+ "meoprobit",
28878
+ "mepoisson",
28879
+ "meprobit",
28880
+ "meqrlogit",
28881
+ "meqrpoisson",
28882
+ "mestreg",
28883
+ "metobit",
28884
+ "xtmixed",
28885
+ "xtmelogit",
28886
+ "xtmepoisson"
28887
+ ]);
28888
+ OMITTED_MODEL_HEAD_COMMANDS = new Set([
28889
+ "mestreg"
28890
+ ]);
28891
+ MIXED_COLON_OPTIONAL_PREFIX_COMMANDS = new Set([
28892
+ "cap",
28893
+ "capt",
28894
+ "captu",
28895
+ "captur",
28896
+ "capture",
28897
+ "qui",
28898
+ "quie",
28899
+ "quiet",
28900
+ "quietl",
28901
+ "quietly",
28902
+ "noi",
28903
+ "nois",
28904
+ "noisi",
28905
+ "noisil",
28906
+ "noisily"
28907
+ ]);
28908
+ MIXED_COLON_REQUIRED_PREFIX_COMMANDS = new Set([
28909
+ "xi"
28910
+ ]);
28911
+ NAME_FRAGMENT_TOKEN_TYPES = new Set([
28912
+ "WORD",
28913
+ "MACRO_REF_LOCAL",
28914
+ "MACRO_REF_GLOBAL"
28915
+ ]);
28916
+ NAME_CONTINUATION_TOKEN_TYPES = new Set([
28917
+ ...NAME_FRAGMENT_TOKEN_TYPES,
28918
+ "NUMBER"
28919
+ ]);
28920
+ mixed_effects_separator_starts_memo = new WeakMap;
28622
28921
  });
28623
28922
 
28624
28923
  // src/providers/mixed-logical-diagnostics.ts
@@ -28641,6 +28940,7 @@ class MixedLogicalOperatorAnalyzer {
28641
28940
  }
28642
28941
  const my_ignored_lines = document.ignored_lines ?? new Set;
28643
28942
  const my_severity = resolve_diagnostic_severity(my_config_severity);
28943
+ const the_mixed_effects_separator_starts = collect_mixed_effects_separator_starts(the_tokens);
28644
28944
  const my_diagnostics = [];
28645
28945
  let my_state = this.fresh_state();
28646
28946
  let my_in_continuation = false;
@@ -28650,6 +28950,13 @@ class MixedLogicalOperatorAnalyzer {
28650
28950
  my_in_continuation = false;
28651
28951
  continue;
28652
28952
  }
28953
+ if (the_mixed_effects_separator_starts.has(my_token)) {
28954
+ my_in_continuation = false;
28955
+ this.flush(my_state, my_diagnostics, my_severity, my_ignored_lines);
28956
+ my_state = this.fresh_state();
28957
+ i++;
28958
+ continue;
28959
+ }
28653
28960
  if (this.is_qualifier_breaker(my_token, my_state)) {
28654
28961
  my_in_continuation = false;
28655
28962
  this.flush(my_state, my_diagnostics, my_severity, my_ignored_lines);
@@ -28674,7 +28981,7 @@ class MixedLogicalOperatorAnalyzer {
28674
28981
  }
28675
28982
  continue;
28676
28983
  }
28677
- if (my_token.type === "WHITESPACE") {
28984
+ if (my_token.type === "WHITESPACE" || my_token.type === "COMMENT_LINE") {
28678
28985
  continue;
28679
28986
  }
28680
28987
  if (my_token.type === "CONTINUATION") {
@@ -28740,11 +29047,10 @@ class MixedLogicalOperatorAnalyzer {
28740
29047
  let my_in_continuation = false;
28741
29048
  for (let my_i = start_index + 1;my_i < the_tokens.length; my_i++) {
28742
29049
  const my_next_token = the_tokens[my_i];
28743
- if (my_next_token.type === "WHITESPACE") {
28744
- continue;
28745
- }
28746
- if (my_next_token.type === "CONTINUATION") {
28747
- my_in_continuation = true;
29050
+ if (COMPOUND_LOGICAL_TRIVIA_TYPES.has(my_next_token.type)) {
29051
+ if (my_next_token.type === "CONTINUATION") {
29052
+ my_in_continuation = true;
29053
+ }
28748
29054
  continue;
28749
29055
  }
28750
29056
  if (is_swallowed_continuation_terminator(my_next_token, my_in_continuation)) {
@@ -28787,21 +29093,27 @@ class MixedLogicalOperatorAnalyzer {
28787
29093
  }
28788
29094
  }
28789
29095
  }
28790
- var import_node4, LOGICAL_OPS, QUALIFIER_BREAKERS, EXPRESSION_BREAKERS;
29096
+ var import_node4, LOGICAL_OPS, QUALIFIER_BREAKERS, EXPRESSION_BREAKERS, COMPOUND_LOGICAL_TRIVIA_TYPES;
28791
29097
  var init_mixed_logical_diagnostics = __esm(() => {
28792
29098
  init_types();
28793
29099
  init_diagnostic_code_description();
28794
29100
  init_diagnostic_severity();
28795
29101
  init_diagnostic_token_stream();
29102
+ init_operator_sequence_diagnostics();
28796
29103
  import_node4 = __toESM(require_main4(), 1);
28797
29104
  LOGICAL_OPS = new Set(["&", "|"]);
28798
29105
  QUALIFIER_BREAKERS = new Set(["if", "in"]);
28799
29106
  EXPRESSION_BREAKERS = new Set([
28800
29107
  "STATEMENT_TERMINATOR",
28801
- "COMMENT_LINE",
28802
29108
  "LBRACE",
28803
29109
  "RBRACE"
28804
29110
  ]);
29111
+ COMPOUND_LOGICAL_TRIVIA_TYPES = new Set([
29112
+ "WHITESPACE",
29113
+ "CONTINUATION",
29114
+ "COMMENT_BLOCK",
29115
+ "COMMENT_LINE"
29116
+ ]);
28805
29117
  });
28806
29118
 
28807
29119
  // src/providers/chained-comparison-diagnostics.ts
@@ -31362,7 +31674,7 @@ function extract_command_name(text) {
31362
31674
  const text_before_colon = text.substring(0, colon_pos).trim();
31363
31675
  const text_after_colon = text.substring(colon_pos + 1).trim();
31364
31676
  const words_before = text_before_colon.split(/\s+/);
31365
- if (words_before.length >= 2 && ["by", "bysort"].includes(words_before[0].toLowerCase()) && text_after_colon.length > 0) {
31677
+ if (words_before.length >= 2 && ["by", "bysort"].includes(words_before[0]) && text_after_colon.length > 0) {
31366
31678
  working_text = text_after_colon;
31367
31679
  }
31368
31680
  }
@@ -31371,8 +31683,7 @@ function extract_command_name(text) {
31371
31683
  if (my_word === ":") {
31372
31684
  continue;
31373
31685
  }
31374
- const lower_word = my_word.toLowerCase();
31375
- if (!PREFIX_COMMANDS2.includes(lower_word)) {
31686
+ if (!PREFIX_COMMANDS2.includes(my_word)) {
31376
31687
  return my_word;
31377
31688
  }
31378
31689
  }
@@ -31426,40 +31737,52 @@ function detect_subcommand_context(text_before_cursor, command_db) {
31426
31737
  return null;
31427
31738
  }
31428
31739
  const trimmed = text_before_cursor.trim();
31429
- const the_words = trimmed.split(/\s+/).filter((w) => w.length > 0);
31430
- if (the_words.length === 0) {
31740
+ const the_parts = trimmed.match(/:|[^\s:]+/g) ?? [];
31741
+ if (the_parts.length === 0) {
31431
31742
  return null;
31432
31743
  }
31433
- const STANDARD_PREFIXES = ["by", "bysort", "quietly", "qui", "capture", "cap", "noisily", "noi"];
31744
+ const STANDARD_PREFIXES = [
31745
+ "by",
31746
+ "bysort",
31747
+ "quietly",
31748
+ "qui",
31749
+ "capture",
31750
+ "cap",
31751
+ "noisily",
31752
+ "noi"
31753
+ ];
31754
+ const BY_PREFIXES = ["by", "bysort"];
31434
31755
  let command_index = 0;
31435
- while (command_index < the_words.length && STANDARD_PREFIXES.includes(the_words[command_index].toLowerCase())) {
31756
+ while (command_index < the_parts.length && STANDARD_PREFIXES.includes(the_parts[command_index])) {
31757
+ const my_prefix = the_parts[command_index];
31436
31758
  command_index++;
31437
- }
31438
- if (trimmed.includes(":")) {
31439
- const after_colon = trimmed.split(":").pop()?.trim() || "";
31440
- const words_after_colon = after_colon.split(/\s+/).filter((w) => w.length > 0);
31441
- if (words_after_colon.length > 0) {
31442
- const potential_prefix2 = words_after_colon[0].toLowerCase();
31443
- if (command_db && command_db.has_subcommands(potential_prefix2)) {
31444
- const words_after_prefix2 = words_after_colon.length - 1;
31445
- if (words_after_prefix2 === 0 && text_before_cursor.endsWith(" ")) {
31446
- return { type: "subcommand", prefix_command: potential_prefix2 };
31447
- }
31448
- if (words_after_prefix2 === 1 && !text_before_cursor.endsWith(" ")) {
31449
- return { type: "subcommand", prefix_command: potential_prefix2 };
31450
- }
31759
+ if (BY_PREFIXES.includes(my_prefix)) {
31760
+ const varlist_start = command_index;
31761
+ while (command_index < the_parts.length && the_parts[command_index] !== ":") {
31762
+ command_index++;
31451
31763
  }
31764
+ if (command_index === varlist_start || command_index >= the_parts.length) {
31765
+ return null;
31766
+ }
31767
+ command_index++;
31768
+ continue;
31769
+ }
31770
+ if (the_parts[command_index] === ":") {
31771
+ command_index++;
31452
31772
  }
31453
- return null;
31454
31773
  }
31455
- if (command_index >= the_words.length) {
31774
+ if (command_index >= the_parts.length) {
31456
31775
  return null;
31457
31776
  }
31458
- const potential_prefix = the_words[command_index].toLowerCase();
31777
+ const potential_prefix = the_parts[command_index].toLowerCase();
31459
31778
  if (!command_db || !command_db.has_subcommands(potential_prefix)) {
31460
31779
  return null;
31461
31780
  }
31462
- const words_after_prefix = the_words.length - command_index - 1;
31781
+ const the_remaining_parts = the_parts.slice(command_index + 1);
31782
+ if (the_remaining_parts.includes(":")) {
31783
+ return null;
31784
+ }
31785
+ const words_after_prefix = the_remaining_parts.length;
31463
31786
  if (words_after_prefix === 0 && text_before_cursor.endsWith(" ")) {
31464
31787
  return { type: "subcommand", prefix_command: potential_prefix };
31465
31788
  }
@@ -31479,7 +31802,7 @@ function is_command_context(text_before_cursor) {
31479
31802
  const parts = trimmed.split(":");
31480
31803
  const before_colon = parts[0].trim();
31481
31804
  const after_colon = parts.slice(1).join(":").trim();
31482
- const first_word = before_colon.split(/\s+/)[0].toLowerCase();
31805
+ const first_word = before_colon.split(/\s+/)[0];
31483
31806
  if (PREFIX_COMMANDS2.includes(first_word)) {
31484
31807
  if (after_colon === "" || !after_colon.includes(" ")) {
31485
31808
  return true;
@@ -31488,8 +31811,8 @@ function is_command_context(text_before_cursor) {
31488
31811
  }
31489
31812
  let all_prefixes = true;
31490
31813
  for (const my_word of the_words) {
31491
- const lower_word = my_word.toLowerCase().replace(/:$/, "");
31492
- if (!PREFIX_COMMANDS2.includes(lower_word)) {
31814
+ const prefix_word = my_word.replace(/:$/, "");
31815
+ if (!PREFIX_COMMANDS2.includes(prefix_word)) {
31493
31816
  all_prefixes = false;
31494
31817
  break;
31495
31818
  }
@@ -31498,9 +31821,9 @@ function is_command_context(text_before_cursor) {
31498
31821
  return true;
31499
31822
  }
31500
31823
  if (the_words.length === 1 && !text_before_cursor.endsWith(" ")) {
31501
- const lower_word = the_words[0].toLowerCase();
31824
+ const prefix_fragment = the_words[0];
31502
31825
  for (const prefix of PREFIX_COMMANDS2) {
31503
- if (prefix.startsWith(lower_word)) {
31826
+ if (prefix.startsWith(prefix_fragment)) {
31504
31827
  return true;
31505
31828
  }
31506
31829
  }
@@ -73489,4 +73812,4 @@ export {
73489
73812
  is_cli_entry_point
73490
73813
  };
73491
73814
 
73492
- //# debugId=B7C3CCA891DAB36764756E2164756E21
73815
+ //# debugId=26F6D7391A01C62064756E2164756E21
@@ -1 +1 @@
1
- 485a12b31b0af8576f9d9b0abe4d3ee35d6ce7a01780df284071c47cc3f08565 sight-server.js
1
+ 29571e2adbaf388e86c862f9563a283a28569601d9fe0563b3df58e8b12a6c37 sight-server.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbearak/sight",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
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.3.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",