Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #176 from prometheus/repo_sync_codemirror
Browse files Browse the repository at this point in the history
Synchronize codemirror from prometheus/prometheus
  • Loading branch information
juliusv authored Dec 21, 2021
2 parents d42af3c + 3b84788 commit ee55cf2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/complete/hybrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '' },
Expand Down

0 comments on commit ee55cf2

Please sign in to comment.