@codemirror/autocomplete
Advanced tools
Comparing version 0.19.7 to 0.19.8
@@ -0,1 +1,11 @@ | ||
## 0.19.8 (2021-11-17) | ||
### Bug fixes | ||
Give the completion tooltip a minimal width, and show ellipsis when completions overflow the tooltip width. | ||
### New features | ||
`autocompletion` now accepts an `aboveCursor` option to make the completion tooltip show up above the cursor. | ||
## 0.19.7 (2021-11-16) | ||
@@ -2,0 +12,0 @@ |
@@ -33,2 +33,8 @@ import * as _codemirror_state from '@codemirror/state'; | ||
/** | ||
By default, completions are shown below the cursor when there is | ||
space. Setting this to true will make the extension put the | ||
completions above the cursor when possible. | ||
*/ | ||
aboveCursor?: boolean; | ||
/** | ||
This can be used to add additional CSS classes to completion | ||
@@ -35,0 +41,0 @@ options. |
@@ -308,2 +308,3 @@ import { Annotation, Facet, combineConfig, StateEffect, StateField, Prec, EditorSelection, Text } from '@codemirror/state'; | ||
optionClass: () => "", | ||
aboveCursor: false, | ||
icons: true, | ||
@@ -591,3 +592,3 @@ addToOptions: [] | ||
} | ||
static build(active, state, id, prev) { | ||
static build(active, state, id, prev, conf) { | ||
let options = sortOptions(active, state); | ||
@@ -606,3 +607,4 @@ if (!options.length) | ||
pos: active.reduce((a, b) => b.hasResult() ? Math.min(a, b.from) : a, 1e8), | ||
create: completionTooltip(completionState) | ||
create: completionTooltip(completionState), | ||
above: conf.aboveCursor, | ||
}, prev ? prev.timestamp : Date.now(), selected); | ||
@@ -635,3 +637,3 @@ } | ||
let open = tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) || | ||
!sameResults(active, this.active) ? CompletionDialog.build(active, state, this.id, this.open) | ||
!sameResults(active, this.active) ? CompletionDialog.build(active, state, this.id, this.open, conf) | ||
: this.open && tr.docChanged ? this.open.map(tr.changes) : this.open; | ||
@@ -972,5 +974,6 @@ if (!open && active.every(a => a.state != 1 /* Pending */) && active.some(a => a.hasResult())) | ||
whiteSpace: "nowrap", | ||
overflow: "auto", | ||
overflow: "hidden auto", | ||
maxWidth_fallback: "700px", | ||
maxWidth: "min(700px, 95vw)", | ||
minWidth: "250px", | ||
maxHeight: "10em", | ||
@@ -981,4 +984,6 @@ listStyle: "none", | ||
"& > li": { | ||
overflowX: "hidden", | ||
textOverflow: "ellipsis", | ||
cursor: "pointer", | ||
padding: "1px 1em 1px 3px", | ||
padding: "1px 3px", | ||
lineHeight: 1.2 | ||
@@ -985,0 +990,0 @@ }, |
{ | ||
"name": "@codemirror/autocomplete", | ||
"version": "0.19.7", | ||
"version": "0.19.8", | ||
"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
138390
3206