@codemirror/autocomplete 6.0.2 → 6.0.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,9 @@
1
+ ## 6.0.3 (2022-07-04)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that caused `closeBrackets` to not close quotes when at the end of a syntactic construct that starts with a similar quote.
6
+
1
7
  ## 6.0.2 (2022-06-15)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1662,10 +1662,18 @@ function nodeStart(state, pos) {
1662
1662
  return tree.parent && tree.from == pos;
1663
1663
  }
1664
1664
  function probablyInString(state, pos, quoteToken) {
1665
+ console.log('check pos', pos);
1665
1666
  let node = language.syntaxTree(state).resolveInner(pos, -1);
1666
1667
  for (let i = 0; i < 5; i++) {
1667
- if (state.sliceDoc(node.from, node.from + quoteToken.length) == quoteToken)
1668
+ if (state.sliceDoc(node.from, node.from + quoteToken.length) == quoteToken) {
1669
+ let first = node.firstChild;
1670
+ while (first && first.from == node.from && first.to - first.from > quoteToken.length) {
1671
+ if (state.sliceDoc(first.to - quoteToken.length, first.to) == quoteToken)
1672
+ return false;
1673
+ first = first.firstChild;
1674
+ }
1668
1675
  return true;
1676
+ }
1669
1677
  let parent = node.to == pos && node.parent;
1670
1678
  if (!parent)
1671
1679
  break;
package/dist/index.js CHANGED
@@ -1658,10 +1658,18 @@ function nodeStart(state, pos) {
1658
1658
  return tree.parent && tree.from == pos;
1659
1659
  }
1660
1660
  function probablyInString(state, pos, quoteToken) {
1661
+ console.log('check pos', pos);
1661
1662
  let node = syntaxTree(state).resolveInner(pos, -1);
1662
1663
  for (let i = 0; i < 5; i++) {
1663
- if (state.sliceDoc(node.from, node.from + quoteToken.length) == quoteToken)
1664
+ if (state.sliceDoc(node.from, node.from + quoteToken.length) == quoteToken) {
1665
+ let first = node.firstChild;
1666
+ while (first && first.from == node.from && first.to - first.from > quoteToken.length) {
1667
+ if (state.sliceDoc(first.to - quoteToken.length, first.to) == quoteToken)
1668
+ return false;
1669
+ first = first.firstChild;
1670
+ }
1664
1671
  return true;
1672
+ }
1665
1673
  let parent = node.to == pos && node.parent;
1666
1674
  if (!parent)
1667
1675
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",