Skip to content

No completions offered for tables inside a CTE #240

Description

@joshbode

When working with tables inside a CTE (aka WITH) no column completions are generated.

e.g. when the cursor is here (at the |)

SELECT
  x.|   -- completions generated correctly
FROM
  some_table x

however this doesn't work for me:

WITH v as (
  SELECT
    x.|   -- no completions generated
  FROM
    some_table x
)
SELECT
  v.*
FROM
  v

Possibly relevant log messages when the completions are not generated:

[2024-02-09T17:55:47.774] [DEBUG] default - WITH
[2024-02-09T17:55:47.774] [DEBUG] default - complete: WITH
[2024-02-09T17:55:47.774] [DEBUG] default - target: WITH

which may mean the completions aren't targeted to the SELECT.

Additionally, an exception is often being thrown here (even when the completions work and the SELECT is the target):

      if (_e.name !== 'SyntaxError') {
        throw _e
      }

since the exception that is coming from the PEG parser is named peg$SyntaxError, I think.

I am using:

  • Neovim (Nightly) with nvim-lspconfig
  • sql-language-server@1.7.0
  • NodeJS v20.11.0
  • A BigQuery database

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions