neoclide/coc.nvim · error · Error
Filetype "${this.doc.filetype}" not enabled by inlayHint con
Error message
Filetype "${this.doc.filetype}" not enabled by inlayHint configuration, see ':h coc-config-inlayHint' What it means
coc.nvim throws this when an inlay hint toggle is requested but the filetype is not matched by the user's `inlayHint.filetypes` / `inlayHint.enable` configuration, so the feature is intentionally disabled for that buffer. The `checkState` guard runs after the provider check.
Source
Thrown at src/handler/inlayHint/buffer.ts:172
return enable === true
}
public enable() {
this.checkState()
this.config.display = true
this.render(undefined, 0).catch(onUnexpectedError)
}
public disable() {
this.checkState()
this.config.display = false
this.clearCache()
this.clearVirtualText()
}
private checkState(): void {
if (!languages.hasProvider(ProviderName.InlayHint, this.doc.textDocument)) throw new Error('Inlay hint provider not found for current document')
if (!this.configEnabled) throw new Error(`Filetype "${this.doc.filetype}" not enabled by inlayHint configuration, see ':h coc-config-inlayHint'`)
}
public toggle(): void {
if (this.config.display) {
this.disable()
} else {
this.enable()
}
}
public clearCache(): void {
this.cancel()
this.currentHints = []
this.regions.clear()
}
public onTextChange(): void {
this.clearCache()View on GitHub (pinned to 50e974d969)
Solutions
- Add the current filetype to `inlayHint.filetypes` in your coc-settings.json (e.g. `"inlayHint.filetypes": ["typescript", "rust"]`).
- Check with `:CocConfig` that the filetype string matches `:set filetype?` exactly.
- If per-filetype settings are used (`inlayHint.<filetype>.enable`), enable it for the right filetype.
- Confirm the buffer's filetype is set correctly (`:set filetype=<ft>`); empty/incorrect filetype won't match config.
Example fix
// before (coc-settings.json)
{ "inlayHint.filetypes": ["typescript"] }
// after
{ "inlayHint.filetypes": ["typescript", "typescriptreact", "javascript"] } Defensive patterns
Strategy: validation
Validate before calling
// ensure current filetype is enabled
const cfg = coc.workspace.getConfiguration('inlayHint')
const fts: string[] = cfg.get('filetypes') ?? []
const enabled = fts.includes(vim.bo.filetype) || (cfg.get(`${vim.bo.filetype}.enable`) ?? true)
if (!enabled) return Try / catch
try {
await coc.commands.executeCommand('document.toggleInlayHints')
} catch (e) {
if (String(e?.message).includes('not enabled by inlayHint configuration'))
return vim.notify(`Add '${vim.bo.filetype}' to inlayHint.filetypes`)
throw e
} Prevention
- Keep inlayHint.filetypes in sync with the filetypes you actually edit
- Match filetype strings exactly as reported by `:set filetype?`
- Use per-filetype enable keys deliberately and document them in your dotfiles
When it happens
Trigger: Calling enable/disable/toggle on a buffer whose filetype is absent from the `inlayHint.filetypes` array, or when `inlayHint.enable` (or `inlayHint.<ft>.enable`) resolves to false for that filetype.
Common situations: User forgot to add the current filetype to `inlayHint.filetypes`; config scoped with `inlayHint.typescript.enable = true` but opening a `.tsx` or javascript file; typo'd filetype string in coc-settings.json.
Related errors
- Inlay hint provider not found for current document
- Semantic tokens highlight not enabled for current filetype:
- Failed to resolve link target
- Rename provider not found for current buffer
- Provider returns null on prepare, unable to rename at curren
AI-assisted analysis of neoclide/coc.nvim@50e974d969 (2026-08-31).
Data as JSON: /api/errors/6ecebf14381bd1e2.
Report an issue: GitHub.