@codemirror/autocomplete
Advanced tools
Comparing version 0.18.4 to 0.18.5
@@ -0,1 +1,9 @@ | ||
## 0.18.5 (2021-04-23) | ||
### Bug fixes | ||
Fix a regression where snippet field selection didn't work with @codemirror/state 0.18.6. | ||
Fix a bug where snippet fields with different position numbers were inappropriately merged. | ||
## 0.18.4 (2021-04-20) | ||
@@ -2,0 +10,0 @@ |
import { EditorState, Transaction, StateCommand, Facet, Extension } from '@codemirror/state'; | ||
import { EditorView, KeyBinding, Command } from '@codemirror/view'; | ||
import { NodeType } from 'lezer-tree'; | ||
import * as lezer_tree from 'lezer-tree'; | ||
@@ -127,3 +127,3 @@ interface CompletionConfig { | ||
text: string; | ||
type: NodeType; | ||
type: lezer_tree.NodeType; | ||
} | null; | ||
@@ -130,0 +130,0 @@ /** |
@@ -1033,3 +1033,3 @@ import { Facet, combineConfig, StateEffect, StateField, Transaction, Text, EditorSelection, Prec, CharCategory } from '@codemirror/state'; | ||
for (let i = 0; i < fields.length; i++) { | ||
if (name ? fields[i].name == name : seq != null && fields[i].seq == seq) | ||
if (seq != null ? fields[i].seq == seq : name ? fields[i].name == name : false) | ||
found = i; | ||
@@ -1043,2 +1043,5 @@ } | ||
found = i; | ||
for (let pos of positions) | ||
if (pos.field >= found) | ||
pos.field++; | ||
} | ||
@@ -1132,5 +1135,7 @@ positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length)); | ||
if (ranges.length > 1) { | ||
let effects = spec.effects = [setActive.of(new ActiveSnippet(ranges, 0))]; | ||
let active = new ActiveSnippet(ranges, 0); | ||
let effects = spec.effects = [setActive.of(active)]; | ||
if (editor.state.field(snippetState, false) === undefined) | ||
effects.push(StateEffect.appendConfig.of([snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme])); | ||
effects.push(StateEffect.appendConfig.of([snippetState.init(() => active), addSnippetKeymap, | ||
snippetPointerHandler, baseTheme])); | ||
} | ||
@@ -1137,0 +1142,0 @@ editor.dispatch(editor.state.update(spec)); |
{ | ||
"name": "@codemirror/autocomplete", | ||
"version": "0.18.4", | ||
"version": "0.18.5", | ||
"description": "Autocompletion for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123926
2889