-
-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
As seen from the ‘getSegments’ tests, identifiers with backticks are classified as “string”,
it('complex query', () => {
expect(getSegments("SELECT COUNT(id), `id`, `username` FROM `users` WHERE `email` = 'test@example.com' AND `foo` = 'BAR' OR 1=1"))
.toStrictEqual([
...
{ name: 'string', content: '`email`' },
...
{ name: 'string', content: "'test@example.com'" },
That means that you can’t set a specific style for backticked identifiers, they just appear in the same color as strings. In the example above, `email`
and 'test@example.com'
end up with the same styling.
Furthermore, identifiers without backticks are lumped together with whitespace and identified as “default”.:
it('test how default works', () => {
expect(getSegments('SELECT * FROM hr.emp'))
.toStrictEqual([
{ name: 'keyword', content: 'SELECT' },
{ name: 'default', content: ' ' },
{ name: 'special', content: '*' },
{ name: 'default', content: ' ' },
{ name: 'keyword', content: 'FROM' },
{ name: 'default', content: ' hr.emp' }
])
})
That means that (for example) you can’t set a background-color
for identifiers like “hr.emp”, because then the background-color
would apply to the whitespace before “hr.emp” too, in addition to the whitespace before and after the *
character.