diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c00850..ca9ceb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ +0.19.0 / 2021-12-20 +=================== + +* **[Enhancement]**: Add a negative autocompletion boost to some trigonometric functions that can overlap with other more popular PromQL functions. +* **[BugFix]**: Improve checking of whether a `PrometheusConfig` object was passed to `newCompleteStrategy()`. + 0.18.0 / 2021-10-20 =================== * **[Feature]**: Allow overriding the API prefix used to contact a remote Prometheus. * **[Feature]**: Add linter and autocompletion support for trigonometric functions (like `sin`, `cos`) -* **[BreakingChange]**: The lib is now exposed under the `dist` folder. When importing `codemirror-promql`, it means you +* **[BreakingChange]**: The lib is now exposed under the `dist` folder. When importing `codemirror-promql`, it means you will need to add `dist` in the import. For example `import { newCompleteStrategy } from 'codemirror-promql/cjs/complete';` becomes `import { newCompleteStrategy } from 'codemirror-promql/dist/cjs/complete';` * **[BreakingChange]**: lezer-promql has been migrated into codemirror-promql in the `grammar` folder @@ -22,8 +28,8 @@ becomes `import { newCompleteStrategy } from 'codemirror-promql/dist/cjs/complet name. (#142) * **[Feature]**: Autocomplete `NaN` and `Inf` (#141) * **[Enhancement]**: Fetch series using the HTTP `POST` method (#139) -* **[Enhancement]**: Upgrade lezer-promql that fixed the parsing of metric names starting with `Inf`/`NaN` like infra (#142) -* **[BreakingChange]**: The constant `promQLLanguage` has been changed to be a function. It takes a `LanguageType` as a +* **[Enhancement]**: Upgrade lezer-promql that fixed the parsing of metric names starting with `Inf`/`NaN` like infra (#142) +* **[BreakingChange]**: The constant `promQLLanguage` has been changed to be a function. It takes a `LanguageType` as a parameter (#142) 0.15.0 / 2021-04-13 diff --git a/package.json b/package.json index 2d65c05..0cd0d7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codemirror-promql", - "version": "0.18.0", + "version": "0.19.0", "description": "a CodeMirror mode for the PromQL language", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", @@ -41,7 +41,8 @@ "@codemirror/lint": "^0.19.3", "@codemirror/state": "^0.19.6", "@codemirror/view": "^0.19.27", - "@lezer/common": "^0.15.10", + "@lezer/common": "^0.15.11", + "@lezer/lr": "^0.15.5", "@lezer/generator": "^0.15.2", "@types/chai": "^4.2.22", "@types/lru-cache": "^5.1.1", @@ -73,7 +74,7 @@ "@codemirror/lint": "^0.19.3", "@codemirror/state": "^0.19.6", "@codemirror/view": "^0.19.27", - "@lezer/common": "^0.15.10" + "@lezer/common": "^0.15.11" }, "prettier": { "singleQuote": true, diff --git a/src/complete/hybrid.ts b/src/complete/hybrid.ts index 8e1c3d4..f9a31ba 100644 --- a/src/complete/hybrid.ts +++ b/src/complete/hybrid.ts @@ -342,7 +342,7 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context } break; case PromQL: - if (!node.firstChild) { + if (node.firstChild !== null && node.firstChild.type.id === 0) { // this situation can happen when there is nothing in the text area and the user is explicitly triggering the autocompletion (with ctrl + space) result.push( { kind: ContextKind.MetricName, metricName: '' },