{"record":{"id":"6ecebf14381bd1e2","repo":"neoclide/coc.nvim","slug":"filetype-this-doc-filetype-not-enabled-by-inl","errorCode":null,"errorMessage":"Filetype \"${this.doc.filetype}\" not enabled by inlayHint configuration, see ':h coc-config-inlayHint'","messagePattern":"Filetype \"(.+?)\" not enabled by inlayHint configuration, see ':h coc-config-inlayHint'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/handler/inlayHint/buffer.ts","lineNumber":172,"sourceCode":"    return enable === true\n  }\n\n  public enable() {\n    this.checkState()\n    this.config.display = true\n    this.render(undefined, 0).catch(onUnexpectedError)\n  }\n\n  public disable() {\n    this.checkState()\n    this.config.display = false\n    this.clearCache()\n    this.clearVirtualText()\n  }\n\n  private checkState(): void {\n    if (!languages.hasProvider(ProviderName.InlayHint, this.doc.textDocument)) throw new Error('Inlay hint provider not found for current document')\n    if (!this.configEnabled) throw new Error(`Filetype \"${this.doc.filetype}\" not enabled by inlayHint configuration, see ':h coc-config-inlayHint'`)\n  }\n\n  public toggle(): void {\n    if (this.config.display) {\n      this.disable()\n    } else {\n      this.enable()\n    }\n  }\n\n  public clearCache(): void {\n    this.cancel()\n    this.currentHints = []\n    this.regions.clear()\n  }\n\n  public onTextChange(): void {\n    this.clearCache()","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/handler/inlayHint/buffer.ts#L154-L190","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (coc-settings.json)\n{ \"inlayHint.filetypes\": [\"typescript\"] }\n// after\n{ \"inlayHint.filetypes\": [\"typescript\", \"typescriptreact\", \"javascript\"] }","handlingStrategy":"validation","validationCode":"// ensure current filetype is enabled\nconst cfg = coc.workspace.getConfiguration('inlayHint')\nconst fts: string[] = cfg.get('filetypes') ?? []\nconst enabled = fts.includes(vim.bo.filetype) || (cfg.get(`${vim.bo.filetype}.enable`) ?? true)\nif (!enabled) return","typeGuard":null,"tryCatchPattern":"try {\n  await coc.commands.executeCommand('document.toggleInlayHints')\n} catch (e) {\n  if (String(e?.message).includes('not enabled by inlayHint configuration'))\n    return vim.notify(`Add '${vim.bo.filetype}' to inlayHint.filetypes`)\n  throw e\n}","preventionTips":["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"],"tags":["lsp","inlay-hint","configuration","coc-nvim"],"backgroundTag":"feature-disabled-by-configuration","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}