## 事象 [[coc.nvimでworkspaceのsymbol検索から特定ディレクトリ配下を無視]]するよう設定を変更したが、`Telescop coc workspace_symbols`の[[Exコマンド]]の結果からは除外されていない。 ## 原因 不明... だが `list.source.symbols.excludes` の設定が考慮されていないと思われる。 ```lua local function get_workspace_symbols_requester() return function(prompt) local results = {} local symbols = CocAction('getWorkspaceSymbols', prompt) if type(symbols) ~= 'table' or vim.tbl_isempty(symbols) then return results end for _, s in ipairs(symbols) do local filename = vim.uri_to_fname(s.location.uri) local kind = vim.lsp.protocol.SymbolKind[s.kind] or 'Unknown' results[#results + 1] = { filename = filename, lnum = s.location.range.start.line + 1, col = s.location.range.start.character + 1, kind = kind, text = string.format('[%s] %s', kind, s.name), } end return results end end ``` ## 回避策 [[telescope-coc.nvim]]の`lua/telescope/_extensions/coc.lua`を変更する。 `node_modules/`を含む場合は除外する場合は以下。 ```lua for _, s in ipairs(symbols) do if not string.find(s.location.uri, "node_modules/") then local filename = vim.uri_to_fname(s.location.uri) local kind = vim.lsp.protocol.SymbolKind[s.kind] or 'Unknown' results[#results + 1] = { filename = filename, lnum = s.location.range.start.line + 1, col = s.location.range.start.character + 1, kind = kind, text = string.format('[%s] %s', kind, s.name), } end end ``` 本来なら、[[coc-settings.json]]から読み取ったパスをパターンマッチするのが望ましい。