@coldsmirk/inkstone-sql 0.18.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,7 +98,9 @@ interface TableRef {
98
98
  */
99
99
  anchor: string;
100
100
  /**
101
- * Character offsets of the name itself, alias excluded — the reader orders refs by them.
101
+ * Character offsets of the whole ref — `from` is where the name starts (the reader orders
102
+ * refs by it), `to` is where the ref ends: after its alias where it wrote one, else after
103
+ * the name. `insert into t as x |` is past the ref either way.
102
104
  */
103
105
  from: number;
104
106
  to: number;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CatalogTable, S as CatalogFunction, _ as readCall, a as createSqlAssist, b as runnableStatement, c as SqlSource, d as CallRead, f as IdentifierRead, g as TableRef, h as StatementRead, i as SqlSignatureHelp, l as createSqlSchema, m as StatementContext, n as SqlCompletionCandidate, o as SqlCatalog, p as Runnable, r as SqlHoverCard, s as SqlSchema, t as SqlAssist, u as qualifiedName, v as readIdentifier, w as SqlKind, x as CatalogColumn, y as readStatement } from "./assist-B5eZ0e5W.js";
1
+ import { C as CatalogTable, S as CatalogFunction, _ as readCall, a as createSqlAssist, b as runnableStatement, c as SqlSource, d as CallRead, f as IdentifierRead, g as TableRef, h as StatementRead, i as SqlSignatureHelp, l as createSqlSchema, m as StatementContext, n as SqlCompletionCandidate, o as SqlCatalog, p as Runnable, r as SqlHoverCard, s as SqlSchema, t as SqlAssist, u as qualifiedName, v as readIdentifier, w as SqlKind, x as CatalogColumn, y as readStatement } from "./assist-D3ScprYR.js";
2
2
  //#region src/functions.d.ts
3
3
  /**
4
4
  * The function vocabulary this bench speaks: the curated floor this project wrote
@@ -85,9 +85,6 @@ interface SqlDialect {
85
85
  functions: SqlFunction[];
86
86
  }
87
87
  declare const SQL_DIALECTS: Record<SqlKind, SqlDialect>;
88
- /**
89
- * One kind's function by name, however the operator cased it. Hover and signature help both ask.
90
- */
91
88
  /**
92
89
  * A signature's parameters as `[start, end)` offsets into the signature itself — offsets rather
93
90
  * than substrings so a call that repeats a parameter name still marks the right one. Everything
package/dist/index.js CHANGED
@@ -620,6 +620,8 @@ function insideNoise(spans, cursor) {
620
620
  //#region src/reader.ts
621
621
  const TOKENS = /[\w$\u{0080}-\u{FFFF}]+|"(?:[^"]|"")*"|`(?:[^`]|``)*`|\[(?:[^\]]|\]\])*\]|\S/gu;
622
622
  const TOKENS_TSQL = /[\w$#\u{0080}-\u{FFFF}]+|"(?:[^"]|"")*"|`(?:[^`]|``)*`|\[(?:[^\]]|\]\])*\]|\S/gu;
623
+ const WORD_KIND = /^[\w$"`[\u{0080}-\u{FFFF}]/u;
624
+ const WORD_KIND_TSQL = /^[\w$#"`[\u{0080}-\u{FFFF}]/u;
623
625
  function statementBounds(blanked, cursor) {
624
626
  const start = cursor === 0 ? 0 : blanked.lastIndexOf(";", cursor - 1) + 1;
625
627
  const close = blanked.indexOf(";", cursor);
@@ -630,12 +632,14 @@ function statementBounds(blanked, cursor) {
630
632
  }
631
633
  function tokenize(blanked, bounds, kind) {
632
634
  const tokens = [];
633
- const tokensFor = kind === "sqlserver" ? TOKENS_TSQL : TOKENS;
635
+ const tsql = kind === "sqlserver";
636
+ const tokensFor = tsql ? TOKENS_TSQL : TOKENS;
637
+ const wordKind = tsql ? WORD_KIND_TSQL : WORD_KIND;
634
638
  for (const match of blanked.slice(bounds.start, bounds.end).matchAll(tokensFor)) {
635
639
  const value = match[0];
636
640
  tokens.push({
637
641
  value,
638
- kind: /^[\w$#"`[\u{0080}-\u{FFFF}]/u.test(value) ? "word" : "punct",
642
+ kind: wordKind.test(value) ? "word" : "punct",
639
643
  start: bounds.start + match.index,
640
644
  end: bounds.start + match.index + value.length
641
645
  });
package/dist/monaco.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as SqlAssist } from "./assist-B5eZ0e5W.js";
1
+ import { t as SqlAssist } from "./assist-D3ScprYR.js";
2
2
  import * as monacoEditor from "monaco-editor";
3
3
  import { IDisposable } from "monaco-editor";
4
4
  //#region src/monaco.d.ts
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as SqlAssist } from "./assist-B5eZ0e5W.js";
1
+ import { t as SqlAssist } from "./assist-D3ScprYR.js";
2
2
  import { MonacoModule } from "./monaco.js";
3
3
  import { ReactNode } from "react";
4
4
  import { editor } from "monaco-editor";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldsmirk/inkstone-sql",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "description": "Schema-aware SQL editing intelligence for Monaco: lexical statement reading under per-dialect noise profiles, catalog-driven completion/hover/signature help, unified-placeholder awareness, formatting, and a drop-in React SQL editor.",
5
5
  "keywords": [
6
6
  "sql",
@@ -49,12 +49,12 @@
49
49
  "monaco-editor": "^0.56.0",
50
50
  "react": "^19.2.8",
51
51
  "react-dom": "^19.2.8",
52
- "@coldsmirk/inkstone-react": "^0.18.0"
52
+ "@coldsmirk/inkstone-react": "^0.19.1"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "monaco-editor": "^0.56.0",
56
56
  "react": ">=19",
57
- "@coldsmirk/inkstone-react": "^0.18.0"
57
+ "@coldsmirk/inkstone-react": "^0.19.1"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "@coldsmirk/inkstone-react": {