{"id":17977389,"url":"https://github.com/jacobdufault/lsp-filter","last_synced_at":"2025-08-09T19:39:37.079Z","repository":{"id":57622942,"uuid":"147853699","full_name":"jacobdufault/lsp-filter","owner":"jacobdufault","description":"lsp-filter wraps a language server so the initialize message response can be customized","archived":false,"fork":false,"pushed_at":"2018-10-26T21:54:11.000Z","size":12,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-03T12:44:36.226Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacobdufault.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-07T17:18:01.000Z","updated_at":"2019-08-21T21:48:29.000Z","dependencies_parsed_at":"2022-08-26T23:51:32.565Z","dependency_job_id":null,"html_url":"https://github.com/jacobdufault/lsp-filter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobdufault%2Flsp-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobdufault%2Flsp-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobdufault%2Flsp-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobdufault%2Flsp-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobdufault","download_url":"https://codeload.github.com/jacobdufault/lsp-filter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245489764,"owners_count":20623789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T17:27:41.136Z","updated_at":"2025-03-25T15:31:34.185Z","avatar_url":"https://github.com/jacobdufault.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lsp-filter\n\nlsp-filter can wrap a language server binary and customize the `initialize`\nmessage response by disabling certain semantic providers.\n\nFor example, you can use cquery and clangd together by disabling completion for\ncquery and disabling everything except completion for clangd.\n\n## Installation\n\n```sh\n$ go get -u github.com/jacobdufault/lsp-filter\n$ lsp-filter # prints out help/usage\n```\n\n## Example\n\nInstall the vscode clangd and cquery extensions, and use `clangd-filter.sh` and\n`cquery-filter.sh` as the language server binary instead of `cquery` or\n`clangd`.\n\n```sh\n$ cat clangd-filter.sh\n#!/usr/bin/env /bin/sh\nexec lsp-filter clangd enable completion signatureHelp codeAction executeCommand -- \"$@\"\n\n$ cat cquery-filter.sh\n#!/usr/bin/env /bin/sh\nexec lsp-filter cquery disable completion signatureHelp codeAction -- \"$@\"\n```\n\nvscode settings file:\n\n```js\n{\n  // ...\n  \"clangd.path\": \"clangd-filter.sh\",\n  \"cquery.launch.command\": \"cquery-filter.sh\",\n  // ...\n\n  // You'll probably also want to turn off diagnostics for cquery, since clangd\n  // provides those.\n  \"cquery.diagnostics.onParse\": false,\n  \"cquery.diagnostics.onType\": false,\n}\n```\n\nMake sure `clangd-filter.sh` and `cquery-filter.sh` are in your `PATH`.\n\n### Custom compile_commands.json directory\n\nBy default clangd only searches for compile_commands.json in the parent\ndirectories of the source files that are being analyzed. However, some build\nsystems such as CMake store their generated compile_commands.json in the build\ndirectory itself which is often not a parent directory of the source files (e.g.\nwhen using src/ and build/ directories). To make clangd look for the\ncompile_commands.json file in a custom directory we have to specify an extra\noption when launching clangd:\n\n```sh\n$ cat clangd-filter.sh\n#!/usr/bin/env /bin/sh\nexec lsp-filter clangd enable completion signatureHelp codeAction executeCommand -- -compile-commands-dir=$PWD/build \"$@\"\n```\n\nThis assumes that clangd is started in the root directory of the current\nproject so that `$PWD` refers to the root directory of the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobdufault%2Flsp-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobdufault%2Flsp-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobdufault%2Flsp-filter/lists"}