@codemirror/language 6.10.2 → 6.10.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 6.10.3 (2024-09-19)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a TypeScript error when using `HighlightStyle` with the `exactOptionalPropertyTypes` typechecking option enabled.
6
+
7
+ Make `delimitedIndent` align to spaces after the opening token.
8
+
1
9
  ## 6.10.2 (2024-06-03)
2
10
 
3
11
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1121,8 +1121,12 @@ function bracketedAligned(context) {
1121
1121
  let next = tree.childAfter(pos);
1122
1122
  if (!next || next == last)
1123
1123
  return null;
1124
- if (!next.type.isSkipped)
1125
- return next.from < lineEnd ? openToken : null;
1124
+ if (!next.type.isSkipped) {
1125
+ if (next.from >= lineEnd)
1126
+ return null;
1127
+ let space = /^ */.exec(openLine.text.slice(openToken.to - openLine.from))[0].length;
1128
+ return { from: openToken.from, to: openToken.to + space };
1129
+ }
1126
1130
  pos = next.to;
1127
1131
  }
1128
1132
  }
package/dist/index.d.cts CHANGED
@@ -845,7 +845,7 @@ declare class HighlightStyle implements Highlighter {
845
845
  */
846
846
  readonly module: StyleModule | null;
847
847
  readonly style: (tags: readonly Tag[]) => string | null;
848
- readonly scope: ((type: NodeType) => boolean) | undefined;
848
+ readonly scope?: (type: NodeType) => boolean;
849
849
  private constructor();
850
850
  /**
851
851
  Create a highlighter style that associates the given styles to
package/dist/index.d.ts CHANGED
@@ -845,7 +845,7 @@ declare class HighlightStyle implements Highlighter {
845
845
  */
846
846
  readonly module: StyleModule | null;
847
847
  readonly style: (tags: readonly Tag[]) => string | null;
848
- readonly scope: ((type: NodeType) => boolean) | undefined;
848
+ readonly scope?: (type: NodeType) => boolean;
849
849
  private constructor();
850
850
  /**
851
851
  Create a highlighter style that associates the given styles to
package/dist/index.js CHANGED
@@ -1119,8 +1119,12 @@ function bracketedAligned(context) {
1119
1119
  let next = tree.childAfter(pos);
1120
1120
  if (!next || next == last)
1121
1121
  return null;
1122
- if (!next.type.isSkipped)
1123
- return next.from < lineEnd ? openToken : null;
1122
+ if (!next.type.isSkipped) {
1123
+ if (next.from >= lineEnd)
1124
+ return null;
1125
+ let space = /^ */.exec(openLine.text.slice(openToken.to - openLine.from))[0].length;
1126
+ return { from: openToken.from, to: openToken.to + space };
1127
+ }
1124
1128
  pos = next.to;
1125
1129
  }
1126
1130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/language",
3
- "version": "6.10.2",
3
+ "version": "6.10.3",
4
4
  "description": "Language support infrastructure for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",