Browse Source

Merge pull request #9775 from nocodb/nc-fix/formula-special-chars

fix: Formula - special character in identifier bug
pull/8898/merge
Anbarasu 2 weeks ago committed by GitHub
parent
commit
af2e7ca694
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      packages/nc-gui/components/monaco/formula.ts

12
packages/nc-gui/components/monaco/formula.ts

@ -43,7 +43,17 @@ const generateLanguageDefinition = (identifiers: string[]) => {
[/"/, { token: 'string.quote', bracket: '@open', next: '@dblString' }],
[/'/, { token: 'string.quote', bracket: '@open', next: '@sglString' }],
[
new RegExp(`\\{(${identifiers.join('|').replace(/[{}]/g, '')})\\}`),
new RegExp(
`\\{(${identifiers
.map((identifier) =>
identifier
// remove curly braces wrapping the identifier
.replace(/^\{([\s\S]+)\}$/, '$1')
// escape special characters
.replace(/[.*+?^${}()|[\]\\-]/g, '\\$&'),
)
.join('|')})\\}`,
),
{
cases: {
'@identifiers': 'identifier',

Loading…
Cancel
Save