Skip to content

Add way to style identifiers (i.e. schema, table, and column names) #147

Closed

Description

@wkeese

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` = '[email protected]' AND `foo` = 'BAR' OR 1=1"))
    .toStrictEqual([
      ...
      { name: 'string', content: '`email`' },
      ...
      { name: 'string', content: "'[email protected]'" },

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 '[email protected]' 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.

Activity

  1. added a commit that references this issue on Oct 4, 2023
    55de594
  2. scriptcoded commented on Oct 4, 2023

    @scriptcoded
    Owner

    Conversation in #148 to avoid multiple threads.

  3. added 2 commits that reference this issue on Oct 4, 2023
    cadb0a9
    d6fb836
  4. scriptsbot commented on Oct 19, 2023

    @scriptsbot
    Collaborator

    This issue has been marked as stale because it has been open for 14 days with no activity. Remove the stale label or comment or this will be closed in 5 days.

  5. wkeese commented on Oct 19, 2023

    @wkeese
    ContributorAuthor

    This should stay open, see #148.

  6. added a commit that references this issue on Oct 24, 2023
    01df1cd
  7. github-actions commented on Oct 24, 2023

    @github-actions
    Contributor

    🎉 This issue has been resolved in version 5.0.0-beta.2 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  8. added 3 commits that reference this issue on Jun 23, 2024
    e681d24
    900dfae
    7b43d64
  9. added a commit that references this issue on Jul 2, 2024
    25677d4
  10. scriptsbot commented on Jul 2, 2024

    @scriptsbot
    Collaborator

    🎉 This issue has been resolved in version 6.0.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions