@effect/tsgo 0.0.12 → 0.0.14

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.
Files changed (2) hide show
  1. package/bin/effect-tsgo.js +637 -55
  2. package/package.json +8 -8
@@ -45596,7 +45596,7 @@ const cursorMove = (column, row = 0) => {
45596
45596
  return command;
45597
45597
  };
45598
45598
  /** @internal */
45599
- const eraseLines = (rows) => {
45599
+ const eraseLines$1 = (rows) => {
45600
45600
  let command = "";
45601
45601
  for (let i = 0; i < rows; i++) command += `${ESC}2K` + (i < rows - 1 ? `${ESC}1A` : "");
45602
45602
  if (rows > 0) command += `${ESC}G`;
@@ -45787,7 +45787,7 @@ const runWithInput = (prompt, terminal, input) => suspend(() => {
45787
45787
  });
45788
45788
  const runLoop = /* @__PURE__ */ fnUntraced(function* (loop, terminal, input) {
45789
45789
  let state = isEffect(loop.initialState) ? yield* loop.initialState : loop.initialState;
45790
- let action = Action.NextFrame({ state });
45790
+ let action = Action$1.NextFrame({ state });
45791
45791
  while (true) {
45792
45792
  const msg = yield* loop.render(state, action);
45793
45793
  yield* orDie(terminal.display(msg));
@@ -45808,24 +45808,24 @@ const runLoop = /* @__PURE__ */ fnUntraced(function* (loop, terminal, input) {
45808
45808
  }
45809
45809
  }
45810
45810
  }, (effect, _, terminal) => ensuring(effect, orDie(terminal.display(cursorShow))));
45811
- const Action = /* @__PURE__ */ taggedEnum();
45811
+ const Action$1 = /* @__PURE__ */ taggedEnum();
45812
45812
  /**
45813
45813
  * Clears all lines taken up by the specified `text`.
45814
45814
  */
45815
- const eraseText = (text, columns) => {
45815
+ const eraseText$1 = (text, columns) => {
45816
45816
  if (columns === 0) return eraseLine + cursorTo(0);
45817
45817
  let rows = 0;
45818
45818
  const lines = text.split(NEWLINE_REGEXP);
45819
45819
  for (const line of lines) rows += 1 + Math.floor(Math.max(line.length - 1, 0) / columns);
45820
- return eraseLines(rows);
45820
+ return eraseLines$1(rows);
45821
45821
  };
45822
45822
  const lines = (prompt, columns) => {
45823
45823
  const lines = prompt.split(NEWLINE_REGEXP);
45824
45824
  return columns === 0 ? lines.length : pipe(map$7(lines, (line) => Math.ceil(line.length / columns)), reduce(0, (left, right) => left + right));
45825
45825
  };
45826
45826
  const clearOutputWithError = (outputText, columns, errorText) => {
45827
- if (errorText !== void 0 && errorText.length > 0) return cursorDown(lines(errorText, columns)) + eraseText(`\n${errorText}`, columns) + eraseText(outputText, columns);
45828
- return eraseText(outputText, columns);
45827
+ if (errorText !== void 0 && errorText.length > 0) return cursorDown(lines(errorText, columns)) + eraseText$1(`\n${errorText}`, columns) + eraseText$1(outputText, columns);
45828
+ return eraseText$1(outputText, columns);
45829
45829
  };
45830
45830
  const renderBeep = beep;
45831
45831
  const NEWLINE_REGEXP = /\r?\n/;
@@ -45833,7 +45833,7 @@ const handleConfirmClear = (options) => {
45833
45833
  return fnUntraced(function* (state, _) {
45834
45834
  const columns = yield* (yield* Terminal).columns;
45835
45835
  const figures = yield* platformFigures;
45836
- return eraseText(renderConfirmOutput(state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny, "?", figures.pointerSmall, options, { plain: true }), columns) + (eraseLine + cursorLeft);
45836
+ return eraseText$1(renderConfirmOutput(state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny, "?", figures.pointerSmall, options, { plain: true }), columns) + (eraseLine + cursorLeft);
45837
45837
  });
45838
45838
  };
45839
45839
  const renderConfirmOutput = (confirm, leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, renderOptions);
@@ -45853,7 +45853,7 @@ const renderConfirmSubmission = /* @__PURE__ */ fnUntraced(function* (value, opt
45853
45853
  });
45854
45854
  const handleConfirmRender = (options) => {
45855
45855
  return (_, action) => {
45856
- return Action.$match(action, {
45856
+ return Action$1.$match(action, {
45857
45857
  Beep: () => succeed(renderBeep),
45858
45858
  NextFrame: ({ state }) => renderConfirmNextFrame(state, options),
45859
45859
  Submit: ({ value }) => renderConfirmSubmission(value, options)
@@ -45864,10 +45864,10 @@ const TRUE_VALUE_REGEXP = /^y|t$/;
45864
45864
  const FALSE_VALUE_REGEXP = /^n|f$/;
45865
45865
  const handleConfirmProcess = (input, defaultValue) => {
45866
45866
  const value = input.input ?? "";
45867
- if (input.key.name === "enter" || input.key.name === "return") return succeed(Action.Submit({ value: defaultValue }));
45868
- if (TRUE_VALUE_REGEXP.test(value.toLowerCase())) return succeed(Action.Submit({ value: true }));
45869
- if (FALSE_VALUE_REGEXP.test(value.toLowerCase())) return succeed(Action.Submit({ value: false }));
45870
- return succeed(Action.Beep());
45867
+ if (input.key.name === "enter" || input.key.name === "return") return succeed(Action$1.Submit({ value: defaultValue }));
45868
+ if (TRUE_VALUE_REGEXP.test(value.toLowerCase())) return succeed(Action$1.Submit({ value: true }));
45869
+ if (FALSE_VALUE_REGEXP.test(value.toLowerCase())) return succeed(Action$1.Submit({ value: false }));
45870
+ return succeed(Action$1.Beep());
45871
45871
  };
45872
45872
  const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options) => {
45873
45873
  const prefix = leadingSymbol + " ";
@@ -45903,7 +45903,7 @@ const renderMultiSelectChoices = (state, options, figures, renderOptions) => {
45903
45903
  const inverseSelectionText = options?.inverseSelection ?? "Inverse Selection";
45904
45904
  const metaOptions = [{ title: selectAllText }, { title: inverseSelectionText }];
45905
45905
  const allChoices = [...metaOptions, ...choices];
45906
- const toDisplay = entriesToDisplay(state.index, allChoices.length, options.maxPerPage);
45906
+ const toDisplay = entriesToDisplay$1(state.index, allChoices.length, options.maxPerPage);
45907
45907
  const documents = [];
45908
45908
  for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
45909
45909
  const choice = allChoices[index];
@@ -45939,14 +45939,14 @@ const renderMultiSelectSubmission = /* @__PURE__ */ fnUntraced(function* (state,
45939
45939
  });
45940
45940
  const processMultiSelectCursorUp = (state, totalChoices) => {
45941
45941
  const newIndex = state.index === 0 ? totalChoices - 1 : state.index - 1;
45942
- return succeed(Action.NextFrame({ state: {
45942
+ return succeed(Action$1.NextFrame({ state: {
45943
45943
  ...state,
45944
45944
  index: newIndex
45945
45945
  } }));
45946
45946
  };
45947
45947
  const processMultiSelectCursorDown = (state, totalChoices) => {
45948
45948
  const newIndex = (state.index + 1) % totalChoices;
45949
- return succeed(Action.NextFrame({ state: {
45949
+ return succeed(Action$1.NextFrame({ state: {
45950
45950
  ...state,
45951
45951
  index: newIndex
45952
45952
  } }));
@@ -45962,7 +45962,7 @@ const processSpace = (state, options) => {
45962
45962
  if (selectedIndices.has(choiceIndex)) selectedIndices.delete(choiceIndex);
45963
45963
  else selectedIndices.add(choiceIndex);
45964
45964
  }
45965
- return succeed(Action.NextFrame({ state: {
45965
+ return succeed(Action$1.NextFrame({ state: {
45966
45966
  ...state,
45967
45967
  selectedIndices
45968
45968
  } }));
@@ -45995,24 +45995,24 @@ const handleMultiSelectProcess = (options) => {
45995
45995
  case "enter":
45996
45996
  case "return": {
45997
45997
  const selectedCount = state.selectedIndices.size;
45998
- if (options.min !== void 0 && selectedCount < options.min) return succeed(Action.NextFrame({ state: {
45998
+ if (options.min !== void 0 && selectedCount < options.min) return succeed(Action$1.NextFrame({ state: {
45999
45999
  ...state,
46000
46000
  error: `At least ${options.min} are required`
46001
46001
  } }));
46002
- if (options.max !== void 0 && selectedCount > options.max) return succeed(Action.NextFrame({ state: {
46002
+ if (options.max !== void 0 && selectedCount > options.max) return succeed(Action$1.NextFrame({ state: {
46003
46003
  ...state,
46004
46004
  error: `At most ${options.max} choices are allowed`
46005
46005
  } }));
46006
46006
  const selectedValues = Array.from(state.selectedIndices).sort(Order$3).map((index) => options.choices[index].value);
46007
- return succeed(Action.Submit({ value: selectedValues }));
46007
+ return succeed(Action$1.Submit({ value: selectedValues }));
46008
46008
  }
46009
- default: return succeed(Action.Beep());
46009
+ default: return succeed(Action$1.Beep());
46010
46010
  }
46011
46011
  };
46012
46012
  };
46013
46013
  const handleMultiSelectRender = (options) => {
46014
46014
  return (state, action) => {
46015
- return Action.$match(action, {
46015
+ return Action$1.$match(action, {
46016
46016
  Beep: () => succeed(renderBeep),
46017
46017
  NextFrame: ({ state }) => renderMultiSelectNextFrame(state, options),
46018
46018
  Submit: () => renderMultiSelectSubmission(state, options)
@@ -46039,7 +46039,7 @@ const renderChoiceTitle = (choice, isSelected, renderOptions) => {
46039
46039
  };
46040
46040
  const renderSelectChoices = (state, options, figures, renderOptions) => {
46041
46041
  const choices = options.choices;
46042
- const toDisplay = entriesToDisplay(state, choices.length, options.maxPerPage);
46042
+ const toDisplay = entriesToDisplay$1(state, choices.length, options.maxPerPage);
46043
46043
  const documents = [];
46044
46044
  for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
46045
46045
  const choice = choices[index];
@@ -46063,19 +46063,19 @@ const renderSelectSubmission = /* @__PURE__ */ fnUntraced(function* (state, opti
46063
46063
  return renderSelectOutput(annotate(figures.tick, green$1), annotate(figures.ellipsis, blackBright), options) + " " + annotate(selected, white) + "\n";
46064
46064
  });
46065
46065
  const processSelectCursorUp = (state, choices) => {
46066
- if (state === 0) return succeed(Action.NextFrame({ state: choices.length - 1 }));
46067
- return succeed(Action.NextFrame({ state: state - 1 }));
46066
+ if (state === 0) return succeed(Action$1.NextFrame({ state: choices.length - 1 }));
46067
+ return succeed(Action$1.NextFrame({ state: state - 1 }));
46068
46068
  };
46069
46069
  const processSelectCursorDown = (state, choices) => {
46070
- if (state === choices.length - 1) return succeed(Action.NextFrame({ state: 0 }));
46071
- return succeed(Action.NextFrame({ state: state + 1 }));
46070
+ if (state === choices.length - 1) return succeed(Action$1.NextFrame({ state: 0 }));
46071
+ return succeed(Action$1.NextFrame({ state: state + 1 }));
46072
46072
  };
46073
46073
  const processSelectNext = (state, choices) => {
46074
- return succeed(Action.NextFrame({ state: (state + 1) % choices.length }));
46074
+ return succeed(Action$1.NextFrame({ state: (state + 1) % choices.length }));
46075
46075
  };
46076
46076
  const handleSelectRender = (options) => {
46077
46077
  return (state, action) => {
46078
- return Action.$match(action, {
46078
+ return Action$1.$match(action, {
46079
46079
  Beep: () => succeed(renderBeep),
46080
46080
  NextFrame: ({ state }) => renderSelectNextFrame(state, options),
46081
46081
  Submit: () => renderSelectSubmission(state, options)
@@ -46086,7 +46086,7 @@ const handleSelectClear = (options) => fnUntraced(function* (state, _) {
46086
46086
  const columns = yield* (yield* Terminal).columns;
46087
46087
  const figures = yield* platformFigures;
46088
46088
  const clearPrompt = eraseLine + cursorLeft;
46089
- return eraseText(`${renderSelectOutput("?", figures.pointerSmall, options, { plain: true })}\n${renderSelectChoices(state, options, figures, { plain: true })}`, columns) + clearPrompt;
46089
+ return eraseText$1(`${renderSelectOutput("?", figures.pointerSmall, options, { plain: true })}\n${renderSelectChoices(state, options, figures, { plain: true })}`, columns) + clearPrompt;
46090
46090
  });
46091
46091
  const handleSelectProcess = (options) => {
46092
46092
  return (input, state) => {
@@ -46099,10 +46099,10 @@ const handleSelectProcess = (options) => {
46099
46099
  case "enter":
46100
46100
  case "return": {
46101
46101
  const selected = options.choices[state];
46102
- if (selected.disabled) return succeed(Action.Beep());
46103
- return succeed(Action.Submit({ value: selected.value }));
46102
+ if (selected.disabled) return succeed(Action$1.Beep());
46103
+ return succeed(Action$1.Submit({ value: selected.value }));
46104
46104
  }
46105
- default: return succeed(Action.Beep());
46105
+ default: return succeed(Action$1.Beep());
46106
46106
  }
46107
46107
  };
46108
46108
  };
@@ -46157,12 +46157,12 @@ const renderTextSubmission = /* @__PURE__ */ fnUntraced(function* (state, option
46157
46157
  return renderTextOutput(state, annotate(figures.tick, green$1), annotate(figures.ellipsis, blackBright), options, void 0, true) + "\n";
46158
46158
  });
46159
46159
  const processTextBackspace = (state) => {
46160
- if (state.cursor <= 0) return succeed(Action.Beep());
46160
+ if (state.cursor <= 0) return succeed(Action$1.Beep());
46161
46161
  const beforeCursor = state.value.slice(0, state.cursor - 1);
46162
46162
  const afterCursor = state.value.slice(state.cursor);
46163
46163
  const cursor = state.cursor - 1;
46164
46164
  const value = `${beforeCursor}${afterCursor}`;
46165
- return succeed(Action.NextFrame({ state: {
46165
+ return succeed(Action$1.NextFrame({ state: {
46166
46166
  ...state,
46167
46167
  cursor,
46168
46168
  value,
@@ -46170,28 +46170,28 @@ const processTextBackspace = (state) => {
46170
46170
  } }));
46171
46171
  };
46172
46172
  const processTextCursorLeft = (state) => {
46173
- if (state.cursor <= 0) return succeed(Action.Beep());
46173
+ if (state.cursor <= 0) return succeed(Action$1.Beep());
46174
46174
  const cursor = state.cursor - 1;
46175
- return succeed(Action.NextFrame({ state: {
46175
+ return succeed(Action$1.NextFrame({ state: {
46176
46176
  ...state,
46177
46177
  cursor,
46178
46178
  error: void 0
46179
46179
  } }));
46180
46180
  };
46181
46181
  const processTextCursorRight = (state) => {
46182
- if (state.cursor >= state.value.length) return succeed(Action.Beep());
46182
+ if (state.cursor >= state.value.length) return succeed(Action$1.Beep());
46183
46183
  const cursor = Math.min(state.cursor + 1, state.value.length);
46184
- return succeed(Action.NextFrame({ state: {
46184
+ return succeed(Action$1.NextFrame({ state: {
46185
46185
  ...state,
46186
46186
  cursor,
46187
46187
  error: void 0
46188
46188
  } }));
46189
46189
  };
46190
46190
  const processTab = (state, options) => {
46191
- if (state.value === options.default) return succeed(Action.Beep());
46191
+ if (state.value === options.default) return succeed(Action$1.Beep());
46192
46192
  const value = getValue(state, options);
46193
46193
  const cursor = value.length;
46194
- return succeed(Action.NextFrame({ state: {
46194
+ return succeed(Action$1.NextFrame({ state: {
46195
46195
  ...state,
46196
46196
  value,
46197
46197
  cursor,
@@ -46201,7 +46201,7 @@ const processTab = (state, options) => {
46201
46201
  const defaultTextProcessor = (input, state) => {
46202
46202
  const value = `${state.value.slice(0, state.cursor)}${input}${state.value.slice(state.cursor)}`;
46203
46203
  const cursor = state.cursor + input.length;
46204
- return succeed(Action.NextFrame({ state: {
46204
+ return succeed(Action$1.NextFrame({ state: {
46205
46205
  ...state,
46206
46206
  cursor,
46207
46207
  value,
@@ -46210,7 +46210,7 @@ const defaultTextProcessor = (input, state) => {
46210
46210
  };
46211
46211
  const handleTextRender = (options) => {
46212
46212
  return (state, action) => {
46213
- return Action.$match(action, {
46213
+ return Action$1.$match(action, {
46214
46214
  Beep: () => succeed(renderBeep),
46215
46215
  NextFrame: ({ state }) => renderTextNextFrame(state, options),
46216
46216
  Submit: () => renderTextSubmission(state, options)
@@ -46227,12 +46227,12 @@ const handleTextProcess = (options) => {
46227
46227
  case "return": {
46228
46228
  const value = getValue(state, options);
46229
46229
  return match$1(options.validate(value), {
46230
- onFailure: (error) => Action.NextFrame({ state: {
46230
+ onFailure: (error) => Action$1.NextFrame({ state: {
46231
46231
  ...state,
46232
46232
  value,
46233
46233
  error
46234
46234
  } }),
46235
- onSuccess: (value) => Action.Submit({ value })
46235
+ onSuccess: (value) => Action$1.Submit({ value })
46236
46236
  });
46237
46237
  }
46238
46238
  case "tab": return processTab(state, options);
@@ -46262,7 +46262,7 @@ const basePrompt = (options, type) => {
46262
46262
  clear: handleTextClear(opts)
46263
46263
  });
46264
46264
  };
46265
- const entriesToDisplay = (cursor, total, maxVisible) => {
46265
+ const entriesToDisplay$1 = (cursor, total, maxVisible) => {
46266
46266
  const max = maxVisible === void 0 ? total : maxVisible;
46267
46267
  let startIndex = Math.min(total - max, cursor - Math.floor(max / 2));
46268
46268
  if (startIndex < 0) startIndex = 0;
@@ -195732,7 +195732,7 @@ var FileReadError = class extends TaggedError("FileReadError") {
195732
195732
  //#endregion
195733
195733
  //#region package.json
195734
195734
  var name = "@effect/tsgo";
195735
- var version = "0.0.12";
195735
+ var version = "0.0.14";
195736
195736
 
195737
195737
  //#endregion
195738
195738
  //#region src/setup/consts.ts
@@ -195813,16 +195813,28 @@ const assessTsConfig = (input) => {
195813
195813
  const sourceFile = import_typescript.parseJsonText(input.fileName, input.text);
195814
195814
  const parsed = import_typescript.convertToObject(sourceFile, []);
195815
195815
  const hasPlugins = parsed.compilerOptions?.plugins !== void 0;
195816
- const hasLspPlugin = (parsed.compilerOptions?.plugins ?? []).some((plugin) => plugin.name === LSP_PLUGIN_NAME);
195816
+ const plugins = parsed.compilerOptions?.plugins ?? [];
195817
+ const hasLspPlugin = plugins.some((plugin) => plugin.name === LSP_PLUGIN_NAME);
195818
+ const currentDiagnosticSeverities = getCurrentDiagnosticSeverities(plugins);
195817
195819
  return {
195818
195820
  path: input.fileName,
195819
195821
  sourceFile,
195820
195822
  parsed,
195821
195823
  text: input.text,
195822
195824
  hasPlugins,
195823
- hasLspPlugin
195825
+ hasLspPlugin,
195826
+ currentDiagnosticSeverities
195824
195827
  };
195825
195828
  };
195829
+ function getCurrentDiagnosticSeverities(plugins) {
195830
+ const lspPlugin = plugins.find((plugin) => plugin.name === LSP_PLUGIN_NAME);
195831
+ if (!lspPlugin || typeof lspPlugin !== "object" || lspPlugin === null) return none$3();
195832
+ const diagnosticSeverity = lspPlugin.diagnosticSeverity;
195833
+ if (!diagnosticSeverity || typeof diagnosticSeverity !== "object" || Array.isArray(diagnosticSeverity)) return none$3();
195834
+ const result = {};
195835
+ for (const [key, value] of Object.entries(diagnosticSeverity)) if (value === "off" || value === "suggestion" || value === "message" || value === "warning" || value === "error") result[key] = value;
195836
+ return Object.keys(result).length > 0 ? some(result) : none$3();
195837
+ }
195826
195838
  /**
195827
195839
  * Assess VSCode settings from input
195828
195840
  */
@@ -195906,6 +195918,15 @@ function insertNodeAtEndOfList(tracker, sourceFile, nodeArray, newNode) {
195906
195918
  tracker.insertNodeAt(sourceFile, lastElement.end, newNode, { prefix: ",\n" });
195907
195919
  }
195908
195920
  }
195921
+ function createDiagnosticSeverityObject(severities) {
195922
+ const entries = Object.entries(severities).sort(([a], [b]) => a.localeCompare(b));
195923
+ return import_typescript.factory.createObjectLiteralExpression(entries.map(([name, severity]) => import_typescript.factory.createPropertyAssignment(import_typescript.factory.createStringLiteral(name), import_typescript.factory.createStringLiteral(severity))), true);
195924
+ }
195925
+ function createLspPluginObject(target) {
195926
+ const properties = [import_typescript.factory.createPropertyAssignment(import_typescript.factory.createStringLiteral("name"), import_typescript.factory.createStringLiteral(LSP_PLUGIN_NAME))];
195927
+ if (isSome(target.diagnosticSeverities)) properties.push(import_typescript.factory.createPropertyAssignment(import_typescript.factory.createStringLiteral("diagnosticSeverity"), createDiagnosticSeverityObject(target.diagnosticSeverities.value)));
195928
+ return import_typescript.factory.createObjectLiteralExpression(properties, true);
195929
+ }
195909
195930
  /**
195910
195931
  * Create a minimal LanguageServiceHost for use with ChangeTracker
195911
195932
  */
@@ -196091,22 +196112,38 @@ const computeTsConfigChanges = (current, target, lspVersion) => {
196091
196112
  descriptions.push("Update $schema in tsconfig");
196092
196113
  tracker.replaceNode(current.sourceFile, schemaProperty.initializer, schemaPropertyAssignment.initializer);
196093
196114
  }
196094
- const pluginObject = import_typescript.factory.createObjectLiteralExpression([import_typescript.factory.createPropertyAssignment(import_typescript.factory.createStringLiteral("name"), import_typescript.factory.createStringLiteral(LSP_PLUGIN_NAME))], false);
196115
+ const pluginObject = createLspPluginObject(target);
196095
196116
  if (!pluginsProperty) {
196096
196117
  descriptions.push(`Add plugins array with ${LSP_PLUGIN_NAME} plugin`);
196097
196118
  const newPluginsProp = import_typescript.factory.createPropertyAssignment(import_typescript.factory.createStringLiteral("plugins"), import_typescript.factory.createArrayLiteralExpression([pluginObject], true));
196098
196119
  insertNodeAtEndOfList(tracker, current.sourceFile, compilerOptions.properties, newPluginsProp);
196099
196120
  } else if (import_typescript.isArrayLiteralExpression(pluginsProperty.initializer)) {
196100
196121
  const pluginsArray = pluginsProperty.initializer;
196101
- if (!pluginsArray.elements.find((element) => {
196122
+ const lspPluginElement = pluginsArray.elements.find((element) => {
196102
196123
  if (import_typescript.isObjectLiteralExpression(element)) {
196103
196124
  const nameProperty = findPropertyInObject(element, "name");
196104
196125
  if (nameProperty && import_typescript.isStringLiteral(nameProperty.initializer)) return nameProperty.initializer.text === LSP_PLUGIN_NAME;
196105
196126
  }
196106
196127
  return false;
196107
- })) {
196128
+ });
196129
+ if (!lspPluginElement) {
196108
196130
  descriptions.push(`Add ${LSP_PLUGIN_NAME} plugin to existing plugins array`);
196109
196131
  insertNodeAtEndOfList(tracker, current.sourceFile, pluginsArray.elements, pluginObject);
196132
+ } else if (import_typescript.isObjectLiteralExpression(lspPluginElement)) {
196133
+ const diagnosticSeverityProperty = findPropertyInObject(lspPluginElement, "diagnosticSeverity");
196134
+ if (isSome(target.diagnosticSeverities)) {
196135
+ const newDiagnosticSeverityValue = createDiagnosticSeverityObject(target.diagnosticSeverities.value);
196136
+ if (!diagnosticSeverityProperty) {
196137
+ descriptions.push(`Add diagnosticSeverity to ${LSP_PLUGIN_NAME} plugin`);
196138
+ insertNodeAtEndOfList(tracker, current.sourceFile, lspPluginElement.properties, import_typescript.factory.createPropertyAssignment(import_typescript.factory.createStringLiteral("diagnosticSeverity"), newDiagnosticSeverityValue));
196139
+ } else if (import_typescript.isPropertyAssignment(diagnosticSeverityProperty)) {
196140
+ descriptions.push(`Update diagnosticSeverity in ${LSP_PLUGIN_NAME} plugin`);
196141
+ tracker.replaceNode(current.sourceFile, diagnosticSeverityProperty.initializer, newDiagnosticSeverityValue);
196142
+ }
196143
+ } else if (diagnosticSeverityProperty) {
196144
+ descriptions.push(`Remove diagnosticSeverity from ${LSP_PLUGIN_NAME} plugin`);
196145
+ deleteNodeFromList(tracker, current.sourceFile, lspPluginElement.properties, diagnosticSeverityProperty);
196146
+ }
196110
196147
  }
196111
196148
  }
196112
196149
  }
@@ -196383,6 +196420,529 @@ const renderCodeActions = (result, assessmentState) => gen(function* () {
196383
196420
  }
196384
196421
  });
196385
196422
 
196423
+ //#endregion
196424
+ //#region src/rules.json
196425
+ var rules_default = [
196426
+ {
196427
+ "name": "anyUnknownInErrorContext",
196428
+ "description": "Detects 'any' or 'unknown' types in Effect error or requirements channels",
196429
+ "defaultSeverity": "off",
196430
+ "codes": [377030]
196431
+ },
196432
+ {
196433
+ "name": "catchAllToMapError",
196434
+ "description": "Suggests using Effect.mapError instead of Effect.catch + Effect.fail",
196435
+ "defaultSeverity": "suggestion",
196436
+ "codes": [377010]
196437
+ },
196438
+ {
196439
+ "name": "catchUnfailableEffect",
196440
+ "description": "Warns when using error handling on Effects that never fail",
196441
+ "defaultSeverity": "suggestion",
196442
+ "codes": [377009]
196443
+ },
196444
+ {
196445
+ "name": "classSelfMismatch",
196446
+ "description": "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
196447
+ "defaultSeverity": "error",
196448
+ "codes": [377046]
196449
+ },
196450
+ {
196451
+ "name": "deterministicKeys",
196452
+ "description": "Enforces deterministic naming for service/tag/error identifiers based on class names",
196453
+ "defaultSeverity": "off",
196454
+ "codes": [377049]
196455
+ },
196456
+ {
196457
+ "name": "duplicatePackage",
196458
+ "description": "Warns when multiple versions of an Effect-related package are detected in the program",
196459
+ "defaultSeverity": "warning",
196460
+ "codes": [377051]
196461
+ },
196462
+ {
196463
+ "name": "effectFnIife",
196464
+ "description": "Effect.fn or Effect.fnUntraced is called as an IIFE; use Effect.gen instead",
196465
+ "defaultSeverity": "warning",
196466
+ "codes": [377011]
196467
+ },
196468
+ {
196469
+ "name": "effectFnOpportunity",
196470
+ "description": "Suggests using Effect.fn for functions that return an Effect",
196471
+ "defaultSeverity": "suggestion",
196472
+ "codes": [377047]
196473
+ },
196474
+ {
196475
+ "name": "effectGenUsesAdapter",
196476
+ "description": "Warns when using the deprecated adapter parameter in Effect.gen",
196477
+ "defaultSeverity": "warning",
196478
+ "codes": [377027]
196479
+ },
196480
+ {
196481
+ "name": "effectInFailure",
196482
+ "description": "Warns when an Effect is used inside an Effect failure channel",
196483
+ "defaultSeverity": "warning",
196484
+ "codes": [377054]
196485
+ },
196486
+ {
196487
+ "name": "effectInVoidSuccess",
196488
+ "description": "Detects nested Effects in void success channels that may cause unexecuted effects",
196489
+ "defaultSeverity": "warning",
196490
+ "codes": [377020]
196491
+ },
196492
+ {
196493
+ "name": "effectMapVoid",
196494
+ "description": "Suggests using Effect.asVoid instead of Effect.map(() => void 0), Effect.map(() => undefined), or Effect.map(() => {})",
196495
+ "defaultSeverity": "suggestion",
196496
+ "codes": [377018]
196497
+ },
196498
+ {
196499
+ "name": "effectSucceedWithVoid",
196500
+ "description": "Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)",
196501
+ "defaultSeverity": "suggestion",
196502
+ "codes": [377016]
196503
+ },
196504
+ {
196505
+ "name": "extendsNativeError",
196506
+ "description": "Warns when a class directly extends the native Error class",
196507
+ "defaultSeverity": "off",
196508
+ "codes": [377055]
196509
+ },
196510
+ {
196511
+ "name": "floatingEffect",
196512
+ "description": "Detects Effect values that are neither yielded nor assigned",
196513
+ "defaultSeverity": "error",
196514
+ "codes": [377001, 377058]
196515
+ },
196516
+ {
196517
+ "name": "genericEffectServices",
196518
+ "description": "Prevents services with type parameters that cannot be discriminated at runtime",
196519
+ "defaultSeverity": "warning",
196520
+ "codes": [377043]
196521
+ },
196522
+ {
196523
+ "name": "globalErrorInEffectCatch",
196524
+ "description": "Warns when catch callbacks return global Error type instead of typed errors",
196525
+ "defaultSeverity": "warning",
196526
+ "codes": [377022]
196527
+ },
196528
+ {
196529
+ "name": "globalErrorInEffectFailure",
196530
+ "description": "Warns when the global Error type is used in an Effect failure channel",
196531
+ "defaultSeverity": "warning",
196532
+ "codes": [377023]
196533
+ },
196534
+ {
196535
+ "name": "instanceOfSchema",
196536
+ "description": "Suggests using Schema.is instead of instanceof for Effect Schema types",
196537
+ "defaultSeverity": "off",
196538
+ "codes": [377042]
196539
+ },
196540
+ {
196541
+ "name": "layerMergeAllWithDependencies",
196542
+ "description": "Detects interdependencies in Layer.mergeAll calls where one layer provides a service that another layer requires",
196543
+ "defaultSeverity": "warning",
196544
+ "codes": [377035]
196545
+ },
196546
+ {
196547
+ "name": "leakingRequirements",
196548
+ "description": "Detects implementation services leaked in service methods",
196549
+ "defaultSeverity": "suggestion",
196550
+ "codes": [377041]
196551
+ },
196552
+ {
196553
+ "name": "missedPipeableOpportunity",
196554
+ "description": "Suggests using .pipe() for nested function calls",
196555
+ "defaultSeverity": "off",
196556
+ "codes": [377050]
196557
+ },
196558
+ {
196559
+ "name": "missingEffectContext",
196560
+ "description": "Detects Effect values with unhandled context requirements",
196561
+ "defaultSeverity": "error",
196562
+ "codes": [377004]
196563
+ },
196564
+ {
196565
+ "name": "missingEffectError",
196566
+ "description": "Detects Effect values with unhandled error types",
196567
+ "defaultSeverity": "error",
196568
+ "codes": [377003]
196569
+ },
196570
+ {
196571
+ "name": "missingEffectServiceDependency",
196572
+ "description": "Checks that Effect.Service dependencies satisfy all required layer inputs",
196573
+ "defaultSeverity": "off",
196574
+ "codes": [377039, 377040]
196575
+ },
196576
+ {
196577
+ "name": "missingLayerContext",
196578
+ "description": "Detects Layer values with unhandled context requirements",
196579
+ "defaultSeverity": "error",
196580
+ "codes": [377034]
196581
+ },
196582
+ {
196583
+ "name": "missingReturnYieldStar",
196584
+ "description": "Suggests using return yield* for Effects that never succeed",
196585
+ "defaultSeverity": "error",
196586
+ "codes": [377006]
196587
+ },
196588
+ {
196589
+ "name": "missingStarInYieldEffectGen",
196590
+ "description": "Detects bare yield (without *) inside Effect generator scopes",
196591
+ "defaultSeverity": "error",
196592
+ "codes": [377007, 377008]
196593
+ },
196594
+ {
196595
+ "name": "multipleEffectProvide",
196596
+ "description": "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
196597
+ "defaultSeverity": "warning",
196598
+ "codes": [377033]
196599
+ },
196600
+ {
196601
+ "name": "nodeBuiltinImport",
196602
+ "description": "Warns when importing Node.js built-in modules that have Effect-native counterparts",
196603
+ "defaultSeverity": "off",
196604
+ "codes": [377057]
196605
+ },
196606
+ {
196607
+ "name": "nonObjectEffectServiceType",
196608
+ "description": "Ensures Effect.Service types are objects, not primitives",
196609
+ "defaultSeverity": "error",
196610
+ "codes": [377048]
196611
+ },
196612
+ {
196613
+ "name": "outdatedApi",
196614
+ "description": "Detects usage of APIs that have been removed or renamed in Effect v4",
196615
+ "defaultSeverity": "warning",
196616
+ "codes": [377052, 377053]
196617
+ },
196618
+ {
196619
+ "name": "overriddenSchemaConstructor",
196620
+ "description": "Prevents overriding constructors in Schema classes which breaks decoding behavior",
196621
+ "defaultSeverity": "error",
196622
+ "codes": [377044]
196623
+ },
196624
+ {
196625
+ "name": "preferSchemaOverJson",
196626
+ "description": "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify",
196627
+ "defaultSeverity": "suggestion",
196628
+ "codes": [377026]
196629
+ },
196630
+ {
196631
+ "name": "redundantSchemaTagIdentifier",
196632
+ "description": "Suggests removing redundant identifier argument when it equals the tag value in Schema.TaggedClass/TaggedError/TaggedRequest",
196633
+ "defaultSeverity": "suggestion",
196634
+ "codes": [377045]
196635
+ },
196636
+ {
196637
+ "name": "returnEffectInGen",
196638
+ "description": "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
196639
+ "defaultSeverity": "suggestion",
196640
+ "codes": [377014]
196641
+ },
196642
+ {
196643
+ "name": "runEffectInsideEffect",
196644
+ "description": "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
196645
+ "defaultSeverity": "suggestion",
196646
+ "codes": [377024, 377025]
196647
+ },
196648
+ {
196649
+ "name": "schemaStructWithTag",
196650
+ "description": "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
196651
+ "defaultSeverity": "suggestion",
196652
+ "codes": [377036]
196653
+ },
196654
+ {
196655
+ "name": "schemaSyncInEffect",
196656
+ "description": "Suggests using Effect-based Schema methods instead of sync methods inside Effect generators",
196657
+ "defaultSeverity": "suggestion",
196658
+ "codes": [377037]
196659
+ },
196660
+ {
196661
+ "name": "schemaUnionOfLiterals",
196662
+ "description": "Suggests combining multiple Schema.Literal calls in Schema.Union into a single Schema.Literal",
196663
+ "defaultSeverity": "off",
196664
+ "codes": [377038]
196665
+ },
196666
+ {
196667
+ "name": "scopeInLayerEffect",
196668
+ "description": "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
196669
+ "defaultSeverity": "warning",
196670
+ "codes": [377031]
196671
+ },
196672
+ {
196673
+ "name": "serviceNotAsClass",
196674
+ "description": "Warns when ServiceMap.Service is used as a variable instead of a class declaration",
196675
+ "defaultSeverity": "off",
196676
+ "codes": [377056]
196677
+ },
196678
+ {
196679
+ "name": "strictBooleanExpressions",
196680
+ "description": "Enforces boolean types in conditional expressions for type safety",
196681
+ "defaultSeverity": "off",
196682
+ "codes": [377029]
196683
+ },
196684
+ {
196685
+ "name": "strictEffectProvide",
196686
+ "description": "Warns when using Effect.provide with layers outside of application entry points",
196687
+ "defaultSeverity": "off",
196688
+ "codes": [377032]
196689
+ },
196690
+ {
196691
+ "name": "tryCatchInEffectGen",
196692
+ "description": "Discourages try/catch in Effect generators in favor of Effect error handling",
196693
+ "defaultSeverity": "suggestion",
196694
+ "codes": [377012]
196695
+ },
196696
+ {
196697
+ "name": "unknownInEffectCatch",
196698
+ "description": "Warns when catch callbacks return unknown instead of typed errors",
196699
+ "defaultSeverity": "warning",
196700
+ "codes": [377021]
196701
+ },
196702
+ {
196703
+ "name": "unnecessaryEffectGen",
196704
+ "description": "Suggests removing Effect.gen when it contains only a single return statement",
196705
+ "defaultSeverity": "suggestion",
196706
+ "codes": [377017]
196707
+ },
196708
+ {
196709
+ "name": "unnecessaryFailYieldableError",
196710
+ "description": "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
196711
+ "defaultSeverity": "suggestion",
196712
+ "codes": [377019]
196713
+ },
196714
+ {
196715
+ "name": "unnecessaryPipe",
196716
+ "description": "Removes pipe calls with no arguments",
196717
+ "defaultSeverity": "suggestion",
196718
+ "codes": [377013]
196719
+ },
196720
+ {
196721
+ "name": "unnecessaryPipeChain",
196722
+ "description": "Simplifies chained pipe calls into a single pipe call",
196723
+ "defaultSeverity": "suggestion",
196724
+ "codes": [377015]
196725
+ }
196726
+ ];
196727
+
196728
+ //#endregion
196729
+ //#region src/setup/rule-info.ts
196730
+ function getAllRules() {
196731
+ return rules_default;
196732
+ }
196733
+ function cycleSeverity(current, direction) {
196734
+ const order = [
196735
+ "off",
196736
+ "suggestion",
196737
+ "message",
196738
+ "warning",
196739
+ "error"
196740
+ ];
196741
+ const currentIndex = order.indexOf(current);
196742
+ if (direction === "right") return order[(currentIndex + 1) % order.length];
196743
+ return order[(currentIndex - 1 + order.length) % order.length];
196744
+ }
196745
+ const shortNames = {
196746
+ off: "off",
196747
+ suggestion: "sugg",
196748
+ message: "info",
196749
+ warning: "warn",
196750
+ error: "err"
196751
+ };
196752
+ const MAX_SEVERITY_LENGTH = Object.values(shortNames).reduce((max, name) => Math.max(max, name.length), 0);
196753
+ function getSeverityShortName(severity) {
196754
+ return shortNames[severity] ?? "???";
196755
+ }
196756
+
196757
+ //#endregion
196758
+ //#region src/ansi.ts
196759
+ const RESET = "\x1B[0m";
196760
+ const BOLD = "\x1B[0;1m";
196761
+ const DIM = "\x1B[0;90m";
196762
+ const GREEN = "\x1B[0;32m";
196763
+ const WHITE = "\x1B[0;37m";
196764
+ const CYAN_BRIGHT = "\x1B[0;96m";
196765
+ const BG_BLACK_BRIGHT = "\x1B[0;100m";
196766
+ const BG_RED = "\x1B[41m";
196767
+ const BG_YELLOW = "\x1B[43m";
196768
+ const BG_BLUE = "\x1B[0;44m";
196769
+ const BG_CYAN = "\x1B[0;46m";
196770
+ const ansi = (text, code) => `${code}${text}${RESET}`;
196771
+ const ERASE_LINE = "\x1B[2K";
196772
+ const CURSOR_LEFT = "\r";
196773
+ const CURSOR_HIDE = "\x1B[?25l";
196774
+ const CURSOR_TO_0 = "\x1B[G";
196775
+ const BEEP = "\x07";
196776
+
196777
+ //#endregion
196778
+ //#region src/setup/rule-prompt.ts
196779
+ function eraseLines(count) {
196780
+ let result = "";
196781
+ for (let i = 0; i < count; i++) {
196782
+ if (i > 0) result += "\x1B[1A";
196783
+ result += ERASE_LINE;
196784
+ }
196785
+ if (count > 0) result += CURSOR_LEFT;
196786
+ return result;
196787
+ }
196788
+ const Action = taggedEnum();
196789
+ const NEWLINE_REGEX = /\r?\n/;
196790
+ function eraseText(text, columns) {
196791
+ if (columns === 0) return ERASE_LINE + CURSOR_TO_0;
196792
+ let rows = 0;
196793
+ const lines = text.split(/\r?\n/);
196794
+ for (const line of lines) rows += 1 + Math.floor(Math.max(line.length - 1, 0) / columns);
196795
+ return eraseLines(rows);
196796
+ }
196797
+ function entriesToDisplay(cursor, total, maxVisible) {
196798
+ const max = maxVisible === void 0 ? total : maxVisible;
196799
+ let startIndex = Math.min(total - max, cursor - Math.floor(max / 2));
196800
+ if (startIndex < 0) startIndex = 0;
196801
+ const endIndex = Math.min(startIndex + max, total);
196802
+ return {
196803
+ startIndex,
196804
+ endIndex
196805
+ };
196806
+ }
196807
+ const figuresValue = {
196808
+ arrowUp: "↑",
196809
+ arrowDown: "↓",
196810
+ tick: "✔",
196811
+ pointerSmall: "›"
196812
+ };
196813
+ function getSeverityStyle(severity) {
196814
+ return {
196815
+ off: WHITE + BG_BLACK_BRIGHT,
196816
+ suggestion: WHITE + BG_CYAN,
196817
+ message: WHITE + BG_BLUE,
196818
+ warning: WHITE + BG_YELLOW,
196819
+ error: WHITE + BG_RED
196820
+ }[severity];
196821
+ }
196822
+ function renderOutput(leadingSymbol, trailingSymbol, options) {
196823
+ const annotateLine = (line) => ansi(line, BOLD);
196824
+ const prefix = leadingSymbol + " ";
196825
+ return match$6(options.message.split(NEWLINE_REGEX), {
196826
+ onEmpty: () => `${prefix}${trailingSymbol}`,
196827
+ onNonEmpty: (promptLines) => {
196828
+ return `${prefix}${map$7(promptLines, (line) => annotateLine(line)).join("\n ")} ${trailingSymbol} `;
196829
+ }
196830
+ });
196831
+ }
196832
+ function renderRules(state, options, figs, columns) {
196833
+ const toDisplay = entriesToDisplay(state.index, options.rules.length, options.maxPerPage);
196834
+ const documents = [];
196835
+ for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
196836
+ const rule = options.rules[index];
196837
+ const isHighlighted = state.index === index;
196838
+ const currentSeverity = state.severities[rule.name] ?? rule.defaultSeverity;
196839
+ const hasChanged = currentSeverity !== rule.defaultSeverity;
196840
+ let prefix = " ";
196841
+ if (index === toDisplay.startIndex && toDisplay.startIndex > 0) prefix = figs.arrowUp;
196842
+ else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < options.rules.length) prefix = figs.arrowDown;
196843
+ const severityStr = ansi(` ${getSeverityShortName(currentSeverity).padEnd(MAX_SEVERITY_LENGTH, " ")} `, getSeverityStyle(currentSeverity));
196844
+ const nameText = hasChanged ? `${rule.name}*` : rule.name;
196845
+ const nameStr = isHighlighted ? ansi(nameText, CYAN_BRIGHT) : nameText;
196846
+ const mainLine = `${prefix} ${severityStr} ${nameStr}`;
196847
+ if (isHighlighted && rule.description) {
196848
+ const indentWidth = 2 + (MAX_SEVERITY_LENGTH + 2) + 1;
196849
+ const indent = " ".repeat(indentWidth);
196850
+ const availableWidth = columns - indentWidth;
196851
+ const truncatedDescription = availableWidth > 0 && rule.description.length > availableWidth ? rule.description.substring(0, availableWidth - 1) + "…" : rule.description;
196852
+ documents.push(mainLine + "\n" + ansi(indent + truncatedDescription, DIM));
196853
+ } else documents.push(mainLine);
196854
+ }
196855
+ return documents.join("\n");
196856
+ }
196857
+ function renderNextFrame(state, options) {
196858
+ return gen(function* () {
196859
+ const rulesStr = renderRules(state, options, figuresValue, yield* (yield* Terminal).columns);
196860
+ const promptMsg = renderOutput(ansi("?", CYAN_BRIGHT), figuresValue.pointerSmall, options);
196861
+ const helpText = ansi("Use ↑/↓ to navigate, ←/→ to change severity, Enter to finish", DIM);
196862
+ return CURSOR_HIDE + promptMsg + "\n" + helpText + "\n" + rulesStr;
196863
+ });
196864
+ }
196865
+ function renderSubmission(state, options) {
196866
+ return gen(function* () {
196867
+ const changedCount = Object.entries(state.severities).filter(([name, severity]) => {
196868
+ const rule = options.rules.find((current) => current.name === name);
196869
+ return rule && severity !== rule.defaultSeverity;
196870
+ }).length;
196871
+ const result = ansi(`${changedCount} rule${changedCount === 1 ? "" : "s"} configured`, WHITE);
196872
+ return renderOutput(ansi(figuresValue.tick, GREEN), "", options) + " " + result + "\n";
196873
+ });
196874
+ }
196875
+ function processCursorUp(state, totalCount) {
196876
+ const newIndex = state.index === 0 ? totalCount - 1 : state.index - 1;
196877
+ return succeed(Action.NextFrame({ state: {
196878
+ ...state,
196879
+ index: newIndex
196880
+ } }));
196881
+ }
196882
+ function processCursorDown(state, totalCount) {
196883
+ const newIndex = (state.index + 1) % totalCount;
196884
+ return succeed(Action.NextFrame({ state: {
196885
+ ...state,
196886
+ index: newIndex
196887
+ } }));
196888
+ }
196889
+ function processSeverityChange(state, options, direction) {
196890
+ const rule = options.rules[state.index];
196891
+ const newSeverity = cycleSeverity(state.severities[rule.name] ?? rule.defaultSeverity, direction);
196892
+ return succeed(Action.NextFrame({ state: {
196893
+ ...state,
196894
+ severities: {
196895
+ ...state.severities,
196896
+ [rule.name]: newSeverity
196897
+ }
196898
+ } }));
196899
+ }
196900
+ function handleProcess(options) {
196901
+ return (input, state) => {
196902
+ const totalCount = options.rules.length;
196903
+ switch (input.key.name) {
196904
+ case "k":
196905
+ case "up": return processCursorUp(state, totalCount);
196906
+ case "j":
196907
+ case "down": return processCursorDown(state, totalCount);
196908
+ case "left": return processSeverityChange(state, options, "left");
196909
+ case "right": return processSeverityChange(state, options, "right");
196910
+ case "enter":
196911
+ case "return": return succeed(Action.Submit({ value: state.severities }));
196912
+ default: return succeed(Action.Beep());
196913
+ }
196914
+ };
196915
+ }
196916
+ function handleClear(options) {
196917
+ return gen(function* () {
196918
+ const columns = yield* (yield* Terminal).columns;
196919
+ const visibleCount = Math.min(options.rules.length, options.maxPerPage);
196920
+ return eraseText("\n".repeat(visibleCount + 2) + options.message, columns) + ERASE_LINE + CURSOR_LEFT;
196921
+ });
196922
+ }
196923
+ function handleRender(options) {
196924
+ return (state, action) => Action.$match(action, {
196925
+ Beep: () => succeed(BEEP),
196926
+ NextFrame: ({ state }) => renderNextFrame(state, options),
196927
+ Submit: () => renderSubmission(state, options)
196928
+ });
196929
+ }
196930
+ function createRulePrompt(rules, initialSeverities) {
196931
+ const options = {
196932
+ message: "Configure Rule Severities",
196933
+ rules,
196934
+ maxPerPage: 10
196935
+ };
196936
+ return custom({
196937
+ index: 0,
196938
+ severities: initialSeverities
196939
+ }, {
196940
+ render: handleRender(options),
196941
+ process: handleProcess(options),
196942
+ clear: () => handleClear(options)
196943
+ });
196944
+ }
196945
+
196386
196946
  //#endregion
196387
196947
  //#region src/setup/target-prompt.ts
196388
196948
  /**
@@ -196420,10 +196980,26 @@ const gatherTargetState = (assessment, context) => gen(function* () {
196420
196980
  lspVersion: none$3(),
196421
196981
  prepareScript: false
196422
196982
  },
196423
- tsconfig: { plugin: false },
196983
+ tsconfig: {
196984
+ plugin: false,
196985
+ diagnosticSeverities: none$3()
196986
+ },
196424
196987
  vscodeSettings: none$3(),
196425
196988
  editors: []
196426
196989
  };
196990
+ const diagnosticSeverities = (yield* select({
196991
+ message: "Would you like to customize the diagnostic severities?",
196992
+ choices: [{
196993
+ title: "Yes",
196994
+ description: "Review the available rules and adjust their severities",
196995
+ value: true,
196996
+ selected: true
196997
+ }, {
196998
+ title: "No",
196999
+ description: "Keep the default severities shipped by @effect/tsgo",
197000
+ value: false
197001
+ }]
197002
+ })) ? some(yield* createRulePrompt(getAllRules(), getOrElse$1(assessment.tsconfig.currentDiagnosticSeverities, () => ({})))) : none$3();
196427
197003
  const hasVscodeSettings = isSome(assessment.vscodeSettings);
196428
197004
  const editors = yield* multiSelect({
196429
197005
  message: "Which editors do you use?",
@@ -196443,7 +197019,10 @@ const gatherTargetState = (assessment, context) => gen(function* () {
196443
197019
  }
196444
197020
  ]
196445
197021
  });
196446
- const vscodeSettings = editors.includes("vscode") ? some({ settings: { "typescript.native-preview.tsdk": "node_modules/@typescript/native-preview" } }) : none$3();
197022
+ const vscodeSettings = editors.includes("vscode") ? some({ settings: {
197023
+ "typescript.native-preview.tsdk": "node_modules/@typescript/native-preview",
197024
+ "typescript.experimental.useTsgo": true
197025
+ } }) : none$3();
196447
197026
  return {
196448
197027
  packageJson: {
196449
197028
  lspVersion: some({
@@ -196452,7 +197031,10 @@ const gatherTargetState = (assessment, context) => gen(function* () {
196452
197031
  }),
196453
197032
  prepareScript: true
196454
197033
  },
196455
- tsconfig: { plugin: true },
197034
+ tsconfig: {
197035
+ plugin: true,
197036
+ diagnosticSeverities
197037
+ },
196456
197038
  vscodeSettings,
196457
197039
  editors
196458
197040
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/tsgo",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -21,13 +21,13 @@
21
21
  "bin/"
22
22
  ],
23
23
  "optionalDependencies": {
24
- "@effect/tsgo-win32-x64": "0.0.12",
25
- "@effect/tsgo-win32-arm64": "0.0.12",
26
- "@effect/tsgo-linux-x64": "0.0.12",
27
- "@effect/tsgo-linux-arm64": "0.0.12",
28
- "@effect/tsgo-linux-arm": "0.0.12",
29
- "@effect/tsgo-darwin-x64": "0.0.12",
30
- "@effect/tsgo-darwin-arm64": "0.0.12"
24
+ "@effect/tsgo-win32-x64": "0.0.14",
25
+ "@effect/tsgo-win32-arm64": "0.0.14",
26
+ "@effect/tsgo-linux-x64": "0.0.14",
27
+ "@effect/tsgo-linux-arm64": "0.0.14",
28
+ "@effect/tsgo-linux-arm": "0.0.14",
29
+ "@effect/tsgo-darwin-x64": "0.0.14",
30
+ "@effect/tsgo-darwin-arm64": "0.0.14"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@effect/platform-node": "4.0.0-beta.11",