Browse Source

Fixed highlight bug

pull/12820/head
mpetrov 2 years ago
parent
commit
49e627a8a6
  1. 5
      ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol-editor.models.ts
  2. 2
      ui-ngx/src/app/shared/models/ace/ace.models.ts
  3. 14
      ui-ngx/src/app/shared/models/calculated-field.models.ts

5
ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol-editor.models.ts

@ -35,7 +35,8 @@ import {
AceHighlightRule, AceHighlightRule,
AceHighlightRules, AceHighlightRules,
dotOperatorHighlightRule, dotOperatorHighlightRule,
endGroupHighlightRule endGroupHighlightRule,
identifierRe
} from '@shared/models/ace/ace.models'; } from '@shared/models/ace/ace.models';
import { HelpLinks, ValueType } from '@shared/models/constants'; import { HelpLinks, ValueType } from '@shared/models/constants';
import { formPropertyCompletions } from '@shared/models/dynamic-form.models'; import { formPropertyCompletions } from '@shared/models/dynamic-form.models';
@ -924,8 +925,6 @@ export class ScadaSymbolElement {
} }
const identifierRe = /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*/;
const scadaSymbolCtxObjectHighlightRule: AceHighlightRule = { const scadaSymbolCtxObjectHighlightRule: AceHighlightRule = {
token: 'tb.scada-symbol-ctx', token: 'tb.scada-symbol-ctx',
regex: /\bctx\b/, regex: /\bctx\b/,

2
ui-ngx/src/app/shared/models/ace/ace.models.ts

@ -376,5 +376,7 @@ export const endGroupHighlightRule: AceHighlightRule = {
next: 'no_regex' next: 'no_regex'
}; };
export const identifierRe = /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*/;

14
ui-ngx/src/app/shared/models/calculated-field.models.ts

@ -32,7 +32,8 @@ import {
AceHighlightRule, AceHighlightRule,
AceHighlightRules, AceHighlightRules,
dotOperatorHighlightRule, dotOperatorHighlightRule,
endGroupHighlightRule endGroupHighlightRule,
identifierRe
} from '@shared/models/ace/ace.models'; } from '@shared/models/ace/ace.models';
export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasEntityDebugSettings, HasTenantId, ExportableEntity<CalculatedFieldId> { export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasEntityDebugSettings, HasTenantId, ExportableEntity<CalculatedFieldId> {
@ -480,6 +481,17 @@ export const getCalculatedFieldArgumentsHighlights = (
? 'calculatedFieldRollingArgumentValue' ? 'calculatedFieldRollingArgumentValue'
: 'calculatedFieldSingleArgumentValue' : 'calculatedFieldSingleArgumentValue'
})), })),
no_regex: [
{
token: 'tb.identifier',
regex: identifierRe,
},
{
token: 'tb.paren.lparen',
regex: '\\(',
next: 'start'
}
],
...calculatedFieldSingleArgumentValueHighlightRules, ...calculatedFieldSingleArgumentValueHighlightRules,
...calculatedFieldRollingArgumentValueHighlightRules, ...calculatedFieldRollingArgumentValueHighlightRules,
...calculatedFieldTimeWindowArgumentValueHighlightRules ...calculatedFieldTimeWindowArgumentValueHighlightRules

Loading…
Cancel
Save