Skip to content

Commit 21e5f63

Browse files
committed
fix(tests): pin .inc as PHP in the language-table and Fortran/Pascal pins
c98c2d8 added .inc to the PHP row, so tests/language_specs.test.ts and tests/keyword_end_adapters.test.ts still expecting .inc unmapped went red. Pins updated, docs/install.md names .inc as PHP. The two stale comments in src/language_specs.ts are left alone on purpose: the file feeds PARSER_FINGERPRINT and EMBED_FINGERPRINT, so a comment edit would force every install to reindex.
1 parent 69a9a68 commit 21e5f63

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎docs/install.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ For VS Code using the token-goat MCP server (`token-goat install --vscode`), ena
406406

407407
One table in `src/language_specs.ts` drives every per-language list token-goat uses, so this is the whole set. **Symbols** means `symbol`, `read "file::Name"`, `skeleton` and `outline` return named declarations from the file. **Structure only** means the file is indexed for headings, keys or sections rather than code symbols.
408408

409-
**Symbols:** ABAP (`.abap`), Apache (`httpd.conf`, `apache2.conf`, `.htaccess`, `.apache`, `.apache2`), Apex (`.cls`, `.trigger`), Assembly (`.s`, `.asm`, `.nasm`), Bash and compatible shells (`.sh`, `.bash`, `.zsh`, `.ksh`, `.bats`), C (`.c`, `.h`), C# (`.cs`), C++ (`.cpp`, `.cc`, `.cxx`, `.hpp`, `.hxx`), Caddyfile (`Caddyfile`, `.caddy`), Clojure (`.clj`, `.cljs`, `.cljc`), CMake (`.cmake`, `CMakeLists.txt`), COBOL (`.cbl`, `.cob`, `.cobol`, `.cpy`), Common Lisp (`.lisp`, `.lsp`, `.cl`), Dart (`.dart`), Elixir (`.ex`, `.exs`), Emacs Lisp (`.el`), Erlang (`.erl`, `.hrl`), F# (`.fs`, `.fsi`, `.fsx`), Fortran (`.f`, `.for`, `.f77`, `.f90`, `.f95`, `.f03`, `.f08`), GLSL (`.glsl`, `.vert`, `.frag`, `.comp`, `.geom`, `.tesc`, `.tese`), Go (`.go`), GraphQL (`.graphql`, `.gql`), Groovy (`.groovy`, `.gvy`, `.gradle`, `Jenkinsfile`), Haskell (`.hs`), HLSL (`.hlsl`, `.hlsli`), Java (`.java`), JavaScript (`.js`, `.jsx`, `.mjs`, `.cjs`), JCL (`.jcl`), Kotlin (`.kt`, `.kts`), Lua (`.lua`), MATLAB, Metal (`.metal`), Natural (`.nsp`, `.nsn`, `.nss`, `.nsa`, `.nsl`, `.nsg`, `.nsc`, `.nsh`), Nginx (`nginx.conf`, `.nginx`), Nix (`.nix`), Objective-C (`.mm`, and a `.h` that declares an `@interface` or `@protocol`), OCaml (`.ml`, `.mli`), OpenEdge ABL, Pascal (`.pas`, `.dpr`, `.dpk`, `.lpr`, `.dfm`), Perl (`.pl`, `.pm`), PHP (`.php`), PL/I (`.pli`, `.pl1`), PowerShell (`.ps1`, `.psm1`), Protocol Buffers (`.proto`), Python and Starlark (`.py`, `.pyi`, `.bzl`, `.star`, `BUILD`, `WORKSPACE`, `MODULE.bazel`), R (`.r`), Racket (`.rkt`, `.rktl`), RPG (`.rpgle`, `.sqlrpgle`), Ruby (`.rb`, `.ruby`, `.rake`, `Gemfile`, `Rakefile`, and the other extensionless Ruby DSL files), Rust (`.rs`), Salesforce markup (`.cmp`, `.app`, `.evt`, `.intf`, `.design`, `.auradoc`, `.tokens`, `.page`, `.component`, `.email`), Salesforce metadata, SAS (`.sas`), Scala (`.scala`, `.sc`), Scheme (`.scm`, `.ss`), Solidity (`.sol`), SQL and PL/SQL (`.sql`, `.pks`, `.pkb`, `.pls`, `.plsql`, `.pck`, `.prc`, `.fnc`, `.trg`, `.tps`, `.tpb`; including DuckDB `CREATE MACRO` and `CREATE SECRET` statements), Swift (`.swift`), Terraform (`.tf`, `.tfvars`, `.hcl`), Thrift (`.thrift`), TypeScript (`.ts`, `.tsx`, `.mts`, `.cts`), VHDL (`.vhd`, `.vhdl`), Visual Basic (`.vb`, `.bas`, `.vbs`, `.frm`), WGSL (`.wgsl`), Windows batch (`.bat`, `.cmd`), Zig (`.zig`).
409+
**Symbols:** ABAP (`.abap`), Apache (`httpd.conf`, `apache2.conf`, `.htaccess`, `.apache`, `.apache2`), Apex (`.cls`, `.trigger`), Assembly (`.s`, `.asm`, `.nasm`), Bash and compatible shells (`.sh`, `.bash`, `.zsh`, `.ksh`, `.bats`), C (`.c`, `.h`), C# (`.cs`), C++ (`.cpp`, `.cc`, `.cxx`, `.hpp`, `.hxx`), Caddyfile (`Caddyfile`, `.caddy`), Clojure (`.clj`, `.cljs`, `.cljc`), CMake (`.cmake`, `CMakeLists.txt`), COBOL (`.cbl`, `.cob`, `.cobol`, `.cpy`), Common Lisp (`.lisp`, `.lsp`, `.cl`), Dart (`.dart`), Elixir (`.ex`, `.exs`), Emacs Lisp (`.el`), Erlang (`.erl`, `.hrl`), F# (`.fs`, `.fsi`, `.fsx`), Fortran (`.f`, `.for`, `.f77`, `.f90`, `.f95`, `.f03`, `.f08`), GLSL (`.glsl`, `.vert`, `.frag`, `.comp`, `.geom`, `.tesc`, `.tese`), Go (`.go`), GraphQL (`.graphql`, `.gql`), Groovy (`.groovy`, `.gvy`, `.gradle`, `Jenkinsfile`), Haskell (`.hs`), HLSL (`.hlsl`, `.hlsli`), Java (`.java`), JavaScript (`.js`, `.jsx`, `.mjs`, `.cjs`), JCL (`.jcl`), Kotlin (`.kt`, `.kts`), Lua (`.lua`), MATLAB, Metal (`.metal`), Natural (`.nsp`, `.nsn`, `.nss`, `.nsa`, `.nsl`, `.nsg`, `.nsc`, `.nsh`), Nginx (`nginx.conf`, `.nginx`), Nix (`.nix`), Objective-C (`.mm`, and a `.h` that declares an `@interface` or `@protocol`), OCaml (`.ml`, `.mli`), OpenEdge ABL, Pascal (`.pas`, `.dpr`, `.dpk`, `.lpr`, `.dfm`), Perl (`.pl`, `.pm`), PHP (`.php`, `.inc`), PL/I (`.pli`, `.pl1`), PowerShell (`.ps1`, `.psm1`), Protocol Buffers (`.proto`), Python and Starlark (`.py`, `.pyi`, `.bzl`, `.star`, `BUILD`, `WORKSPACE`, `MODULE.bazel`), R (`.r`), Racket (`.rkt`, `.rktl`), RPG (`.rpgle`, `.sqlrpgle`), Ruby (`.rb`, `.ruby`, `.rake`, `Gemfile`, `Rakefile`, and the other extensionless Ruby DSL files), Rust (`.rs`), Salesforce markup (`.cmp`, `.app`, `.evt`, `.intf`, `.design`, `.auradoc`, `.tokens`, `.page`, `.component`, `.email`), Salesforce metadata, SAS (`.sas`), Scala (`.scala`, `.sc`), Scheme (`.scm`, `.ss`), Solidity (`.sol`), SQL and PL/SQL (`.sql`, `.pks`, `.pkb`, `.pls`, `.plsql`, `.pck`, `.prc`, `.fnc`, `.trg`, `.tps`, `.tpb`; including DuckDB `CREATE MACRO` and `CREATE SECRET` statements), Swift (`.swift`), Terraform (`.tf`, `.tfvars`, `.hcl`), Thrift (`.thrift`), TypeScript (`.ts`, `.tsx`, `.mts`, `.cts`), VHDL (`.vhd`, `.vhdl`), Visual Basic (`.vb`, `.bas`, `.vbs`, `.frm`), WGSL (`.wgsl`), Windows batch (`.bat`, `.cmd`), Zig (`.zig`).
410410

411411
**Structure only:** Astro (`.astro`), CSS and its preprocessors (`.css`, `.scss`, `.sass`, `.less`), Dockerfile, environment files (`.env`, `.envrc`), HTML (`.html`, `.htm`), INI (`.ini`, `.cfg`, `.conf`), JSON including JSON with comments and Avro schemas (`.json`, `.jsonc`, `.avsc`), Jupyter notebooks (`.ipynb`), Makefiles (`.mk`, `Makefile`), Markdown (`.md`, `.markdown`, `.mdx`), Svelte (`.svelte`), TOML (`.toml`), Vue (`.vue`), YAML (`.yaml`, `.yml`), and seven template-engine dialects read as HTML: Liquid (`.liquid`), Jinja2 (`.j2`, `.jinja`, `.jinja2`), Handlebars (`.hbs`, `.handlebars`), ERB (`.erb`), EJS (`.ejs`), Nunjucks (`.njk`), Twig (`.twig`).
412412

‎tests/keyword_end_adapters.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,12 @@ describe('language detection and collision routing through the real entry points
399399
return file
400400
}
401401

402-
it('maps the Fortran, Pascal and CMake extensions and leaves .fpp, .inc, .pp and other .txt files unknown by path', () => {
402+
it('maps the Fortran, Pascal and CMake extensions and leaves .fpp, .pp and other .txt files unknown by path, with .inc claimed by PHP', () => {
403403
const cases: Array<[string, string]> = [
404404
['a.f', 'fortran'], ['a.for', 'fortran'], ['a.f77', 'fortran'], ['a.F90', 'fortran'], ['a.f95', 'fortran'], ['a.f03', 'fortran'], ['a.f08', 'fortran'],
405405
['a.pas', 'pascal'], ['a.dpr', 'pascal'], ['a.dpk', 'pascal'], ['a.lpr', 'pascal'], ['a.dfm', 'pascal'],
406406
['a.cmake', 'cmake'], ['CMakeLists.txt', 'cmake'], ['sub/cmakelists.txt', 'cmake'],
407-
['a.fpp', 'unknown'], ['a.inc', 'unknown'], ['a.pp', 'unknown'], ['a.m', 'unknown'], ['notes.txt', 'unknown'],
407+
['a.inc', 'php'], ['a.fpp', 'unknown'], ['a.pp', 'unknown'], ['a.m', 'unknown'], ['notes.txt', 'unknown'],
408408
]
409409
for (const [p, lang] of cases) expect(detectLanguage(p), p).toBe(lang)
410410
})

‎tests/language_specs.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ const BATCH_NIX_IDS = ['nix']
116116
const BATCH_SERVERCONF = ['.nginx', '.caddy', '.apache', '.apache2']
117117
const BATCH_SERVERCONF_IDS = ['nginx', 'caddy', 'apache']
118118
const BATCH_SERVERCONF_NAMES = ['nginx.conf', 'caddyfile', 'caddy.conf', 'httpd.conf', 'apache2.conf', '.htaccess']
119+
// .inc added for PHP in c98c2d81f (rules.inc and routes.inc are PHP).
120+
const PHP_INC = ['.inc']
119121

120122
// Every extension either side knows about, so a dropped extension shows up as a removal.
121123
const ALL_EXTS = [...new Set([
@@ -141,7 +143,7 @@ describe('language table: derived lists match the pre-refactor lists except the
141143
it('extension map: only the new mappings were added, nothing moved or dropped', () => {
142144
for (const [ext, lang] of Object.entries(OLD_EXTENSION_LANGUAGE)) expect(EXTENSION_LANGUAGE.get(ext), ext).toBe(lang)
143145
const added = [...EXTENSION_LANGUAGE.keys()].filter((e) => !(e in OLD_EXTENSION_LANGUAGE))
144-
expect(sorted(added)).toEqual(sorted(['.zsh', '.ksh', '.bats', '.bzl', '.star', ...PLSQL, '.jsonc', '.avsc', ...BATCH_C, ...BATCH_A, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_TEMPLATES, ...BATCH_LISP, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX, ...BATCH_SERVERCONF]))
146+
expect(sorted(added)).toEqual(sorted(['.zsh', '.ksh', '.bats', '.bzl', '.star', ...PLSQL, '.jsonc', '.avsc', ...PHP_INC, ...BATCH_C, ...BATCH_A, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_TEMPLATES, ...BATCH_LISP, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX, ...BATCH_SERVERCONF]))
145147
for (const e of ['.zsh', '.ksh', '.bats']) expect(detectLanguage(`a${e}`), e).toBe('bash')
146148
for (const e of ['.bzl', '.star']) expect(detectLanguage(`a${e}`), e).toBe('python')
147149
for (const e of PLSQL) expect(detectLanguage(`a${e.toUpperCase()}`), e).toBe('sql')
@@ -168,12 +170,12 @@ describe('language table: derived lists match the pre-refactor lists except the
168170
})
169171

170172
it('read hook source-hint set: adds the other Ruby extensions and Starlark only', () => {
171-
expect(diff(oldReadSource, 'sourceHints')).toEqual({ added: sorted(['.bzl', '.rake', '.ruby', '.star', ...BATCH_C, ...BATCH_A_CODE, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_LISP, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX]), removed: [] })
173+
expect(diff(oldReadSource, 'sourceHints')).toEqual({ added: sorted(['.bzl', '.rake', '.ruby', '.star', ...PHP_INC, ...BATCH_C, ...BATCH_A_CODE, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_LISP, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX]), removed: [] })
172174
})
173175

174176
it('diff-on-reread set: adds extensions of languages already covered, and the new mappings', () => {
175177
expect(diff((e) => OLD_DIFFABLE_SOURCE_RE.test(`x${e}`), 'diffable')).toEqual({
176-
added: sorted(['.avsc', '.bzl', '.cts', '.hxx', '.kts', '.mts', '.pyi', '.rake', '.ruby', '.star', ...PLSQL, ...BATCH_C, ...BATCH_A_CODE, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_LISP, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX, ...BATCH_SERVERCONF]),
178+
added: sorted(['.avsc', '.bzl', '.cts', '.hxx', '.kts', '.mts', '.pyi', '.rake', '.ruby', '.star', ...PHP_INC, ...PLSQL, ...BATCH_C, ...BATCH_A_CODE, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_LISP, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX, ...BATCH_SERVERCONF]),
177179
removed: [],
178180
})
179181
})
@@ -182,7 +184,7 @@ describe('language table: derived lists match the pre-refactor lists except the
182184
const missed18 = ['.mts', '.cts', '.mjs', '.cjs', '.pyi', '.kts', '.hxx', '.ps1', '.psm1', '.cls', '.trigger', '.sc', '.lua', '.ex', '.exs', '.dart', '.zig', '.r']
183185
expect(missed18).toHaveLength(18)
184186
expect(diff((e) => OLD_GREP_SOURCE_EXT_RE.test(`x${e}`), 'grepSource')).toEqual({
185-
added: sorted([...missed18, '.ruby', '.rake', '.bzl', '.star', ...SF_MARKUP, ...BATCH_C, ...BATCH_A_CODE, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_LISP_GREP_ADDED, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX]),
187+
added: sorted([...missed18, '.ruby', '.rake', '.bzl', '.star', ...PHP_INC, ...SF_MARKUP, ...BATCH_C, ...BATCH_A_CODE, ...BATCH_B1, ...BATCH_D, ...BATCH_VHDL, ...BATCH_LISP_GREP_ADDED, ...BATCH_HASKELL, ...BATCH_OCAML, ...BATCH_FSHARP, ...BATCH_NIX]),
186188
removed: [],
187189
})
188190
})

0 commit comments

Comments
 (0)