mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 05:47:20 +00:00
Merge pull request #13053 from home-assistant/improve-autocompletion
improve autocompletion
This commit is contained in:
commit
5a68e2c977
@ -209,7 +209,7 @@ export class HaCodeEditor extends ReactiveElement {
|
|||||||
private _entityCompletions(
|
private _entityCompletions(
|
||||||
context: CompletionContext
|
context: CompletionContext
|
||||||
): CompletionResult | null | Promise<CompletionResult | null> {
|
): CompletionResult | null | Promise<CompletionResult | null> {
|
||||||
const entityWord = context.matchBefore(/[a-z_]{3,}\./);
|
const entityWord = context.matchBefore(/[a-z_]{3,}\.\w*/);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!entityWord ||
|
!entityWord ||
|
||||||
@ -227,7 +227,7 @@ export class HaCodeEditor extends ReactiveElement {
|
|||||||
return {
|
return {
|
||||||
from: Number(entityWord.from),
|
from: Number(entityWord.from),
|
||||||
options: states,
|
options: states,
|
||||||
span: /^\w*.\w*$/,
|
span: /^[a-z_]{3,}\.\w*$/,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ export class HaCodeEditor extends ReactiveElement {
|
|||||||
private async _mdiCompletions(
|
private async _mdiCompletions(
|
||||||
context: CompletionContext
|
context: CompletionContext
|
||||||
): Promise<CompletionResult | null> {
|
): Promise<CompletionResult | null> {
|
||||||
const match = context.matchBefore(/mdi:/);
|
const match = context.matchBefore(/mdi:\S*/);
|
||||||
|
|
||||||
if (!match || (match.from === match.to && !context.explicit)) {
|
if (!match || (match.from === match.to && !context.explicit)) {
|
||||||
return null;
|
return null;
|
||||||
@ -268,7 +268,7 @@ export class HaCodeEditor extends ReactiveElement {
|
|||||||
return {
|
return {
|
||||||
from: Number(match.from),
|
from: Number(match.from),
|
||||||
options: iconItems,
|
options: iconItems,
|
||||||
span: /^\w*.\w*$/,
|
span: /^mdi:\S*$/,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user