@cratis/screenplay-language 4.53.0 → 4.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,7 @@ import {
23
23
  importablePaths,
24
24
  indentOf,
25
25
  isFileImportLine,
26
+ isQuickFixDiagnostic,
26
27
  knownEventNames,
27
28
  knownTriggerNames,
28
29
  knownTypeNames,
@@ -41,7 +42,7 @@ import {
41
42
  typeReferenceSymbol,
42
43
  typeReferenceText,
43
44
  validateLines
44
- } from "./chunk-7WJEZ72S.js";
45
+ } from "./chunk-GJX4NJYC.js";
45
46
 
46
47
  // tokens.ts
47
48
  var embeddedLanguages = {
@@ -999,13 +1000,14 @@ function createCodeActionProvider(placement) {
999
1000
  return {
1000
1001
  provideCodeActions(model, range, context, token) {
1001
1002
  const migrationRequested = context.only !== void 0 && containsKind(context.only, migrateOptional);
1003
+ const migrationOnly = context.only !== void 0 && migrationRequested && !containsKind(context.only, "quickfix");
1002
1004
  if (token.isCancellationRequested || context.only !== void 0 && !migrationRequested && !containsKind(context.only, "quickfix")) return { actions: [], dispose() {
1003
1005
  } };
1004
- const diagnostic = context.markers.find((marker) => {
1006
+ const diagnostics = context.markers.filter((marker) => {
1005
1007
  const code = typeof marker.code === "object" ? marker.code.value : marker.code;
1006
- return code === DiagnosticCodes.LegacyOptionalSuffix && intersects(marker, range);
1008
+ return isQuickFixDiagnostic(code) && intersects(marker, range);
1007
1009
  });
1008
- if (!migrationRequested && diagnostic === void 0) return { actions: [], dispose() {
1010
+ if (!migrationRequested && diagnostics.length === 0) return { actions: [], dispose() {
1009
1011
  } };
1010
1012
  const version = model.getVersionId();
1011
1013
  const placementKey = JSON.stringify(placement) ?? "";
@@ -1014,7 +1016,12 @@ function createCodeActionProvider(placement) {
1014
1016
  analysis = { version, placement: placementKey, fixes: prepareQuickFixes(model.getValue(), { placement }) };
1015
1017
  cache.set(model, analysis);
1016
1018
  }
1017
- const fixes = analysis.fixes(diagnostic?.startLineNumber).filter((fix) => context.only === void 0 || containsKind(context.only, fix.scope === "document" ? migrateOptional : "quickfix"));
1019
+ const occurrences = migrationOnly ? [] : analysis.fixes(diagnostics.map((diagnostic) => ({
1020
+ line: diagnostic.startLineNumber,
1021
+ diagnosticCode: String(typeof diagnostic.code === "object" ? diagnostic.code.value : diagnostic.code)
1022
+ }))).filter((fix) => fix.scope === "occurrence");
1023
+ const requested = [...occurrences, ...context.only === void 0 || migrationRequested ? analysis.fixes(void 0, DiagnosticCodes.LegacyOptionalSuffix) : []];
1024
+ const fixes = requested.filter((fix) => context.only === void 0 || containsKind(context.only, fix.scope === "document" ? migrateOptional : "quickfix"));
1018
1025
  if (token.isCancellationRequested || model.getVersionId() !== version) return { actions: [], dispose() {
1019
1026
  } };
1020
1027
  return {