Repository navigation
Options of statements and settings of the extension: autocomplete, hover and checks (0.4.0) - #31
Merged
Merged
Conversation
Every clickhouseSql setting now has a markdownDescription with examples and links, and package.json validates it: an enum with descriptions, minimum and maximum, and for the server URL a pattern and format uri. timeoutMs stops at 2147483647, as Node.js fires a longer timer at once. The code reads settings only through settings.ts, which checks each value against package.json. A wrong value is not used: a local setting falls back to its default with a message, a server setting becomes the connection problem. Connection problems name the setting that would fix them, the native port's answer is quoted, and selecting the status bar item opens that setting. query() can also send parameter values as written, for SET param_x. The settings and commands of the README are generated from package.json by scripts/generate-readme.ts, and a test checks that the README, the settings the code reads and the commands it registers match it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where ClickHouse reads a parameter of a name only, as in FROM {t:...},
complete() offers Identifier; in an expression, the data types and
Identifier. After { it offers the parameters that the file writes as
{name:Type} or param_name, then the ones clickhouse-test sets, such as
CLICKHOUSE_DATABASE. In SET and SETTINGS it offers param_name for each
parameter of the file. All 143 suggested types parse with clickhouse
format of master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hover over {name:Type} or param_name shows the parameter: how ClickHouse
reads its value as the type, or as a name for Identifier, where the file
writes and sets it, and the four ways to give it a value: SET, SETTINGS,
--param_name of clickhouse-client and clickhouse local, and the URL of
the HTTP interface. The parameters that clickhouse-test sets, such as
CLICKHOUSE_DATABASE, say so. Completion opens by itself at the colon of
{name:.
The server check sends the values that SET param_x statements earlier in
the file give, as clickhouse-client keeps them, so a query with
parameters is checked instead of failing as UNKNOWN_QUERY_PARAMETER. Only
values that ClickHouse passes on as written are sent: strings without
escapes, unsigned integers and names; clickhouse local turns 1.50 into
1.5, so such a value leaves the parameter unset.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TCPHandler.cpp ends the lines of its HTTP answer with CRLF, so the first line is cut there. The server tests check that the values of SET param_x reach the server with the queries after it, and that a value the type cannot read shows as BAD_QUERY_PARAMETER. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hints.ts ports TestHint of src/Client/TestHint.cpp: the problems that make
clickhouse-client stop reading a file, such as an unknown error name or
"retry N" without until or while, are errors in its words, and a
serverError hint on a statement the client rejects is a warning. Inside
the {...} of a hint, completion offers the commands, the error names and
until, while and serverError after retry; hover gives each error's code.
The 685 error codes come from errorCodeToName() of a binary, through
scripts/generate-errors.ts. On ClickHouse's 12,321 tests in the
clickhouse dialect, 3,361 with hints, it reports nothing.
tags.ts reads the first "-- Tags:" line and the "-- Random settings
limits:" lines as tests/clickhouse-test does: no-stress, which it
refuses, is an error, a tag it does not read is information, and
completion and hover know the tags it reads, by name and by its use-,
no-cpu- and build flag rules. On the tests that marks 59 tags, such as
no-random-mergetree-settings, and no limits line.
After SET dialect = 'kusto' and the other dialects, up to SET dialect =
'clickhouse' or DEFAULT, statements other than SET get no syntax errors,
as clickhouse-client parses them in that dialect: on the 79 tests that
switch, 2763 errors become 1, a Trino SET form.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README lists query parameters, test hints and tags, and other dialects among the features, the changelog has them under Unreleased, CONTRIBUTING the two new generators, and ARCHITECTURE the new modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/generate-options.ts reads system.merge_tree_settings, system.codecs, system.data_skipping_index_types and system.database_engines, the setting lists the sources declare for the other engines, BACKUP and RESTORE, and the docs of EXPLAIN. It asks clickhouse local which names each engine takes, the values of each enum, the parameters codecs and index types take, and ClickHouse's messages for the rest. generate-catalog.ts adds the enum values and the obsolete names of query settings. Probes run in batches with a timeout, as SET interactive_delay = 0 never returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The parser marks each settings list with what it belongs to. checkOptions() checks the names and values of those lists, codecs and their parameters, index and statistics types, formats and compression methods, with ClickHouse's messages; check() is unchanged. complete() offers the settings of the place at the cursor and their values, codecs, index and statistics types and database engines, and describe() documents them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It runs every flagged statement of the corpus in clickhouse local, compares the checks of settings, codecs and index types with ClickHouse on generated values, runs every option completion offers, and times both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both branches changed completion, diagnostics and the docs. The settings completion of opts-sql replaces the old list in complete.ts, so the param_name settings of query parameters now come from optionSuggestions() for SET and query SETTINGS. The extension filters the option diagnostics by the other-dialect spans too, as it does the syntax errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Autocomplete, hover and checks for the options of statements and for the settings of the extension. Version 0.4.0.
.sqlfiles: settings of queries, MergeTree and other engines, databases, columns, EXPLAIN, BACKUP and RESTORE, with their values; codecs and their parameters; index and statistics types; database engines; formats and compression methods. The messages are ClickHouse's own. The catalog is generated from ClickHouse (scripts/generate-options.ts).{name:Type}andparam_name; the server check sends theSET param_namevalues.-- Tags:lines and other dialects are read asclickhouse-clientandclickhouse-testread them.Measured against ClickHouse 26.11 (
npm run oracle:options): 0 false positives on the 271,063 statements of ClickHouse's tests, and 0 false errors on the generated values. 6,014 inserted suggestions ran without an unknown-name or bad-value error.checkOptions()takes about 170 ms per 1,000 statements.npm test: 1,582 tests, 0 failures. VS Code e2e on 1.145.2 and on 1.90.0: 65 passing, 0 failing.🤖 Generated with Claude Code