{"id":13446626,"url":"https://github.com/ycm-core/ycmd","last_synced_at":"2025-12-16T16:47:03.380Z","repository":{"id":17067629,"uuid":"19832415","full_name":"ycm-core/ycmd","owner":"ycm-core","description":"A code-completion \u0026 code-comprehension server","archived":false,"fork":false,"pushed_at":"2025-10-17T19:24:23.000Z","size":27896,"stargazers_count":1731,"open_issues_count":31,"forks_count":776,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-10-17T22:10:27.181Z","etag":null,"topics":["code-analysis","code-completion","editor","semantic-engine"],"latest_commit_sha":null,"homepage":"https://ycm-core.github.io/ycmd/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ycm-core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-05-15T19:30:17.000Z","updated_at":"2025-10-17T19:24:29.000Z","dependencies_parsed_at":"2023-12-22T19:31:27.355Z","dependency_job_id":"6c02a5c1-8d83-4fa7-90d8-0d57458af5c7","html_url":"https://github.com/ycm-core/ycmd","commit_stats":{"total_commits":2128,"total_committers":159,"mean_commits":"13.383647798742139","dds":0.75,"last_synced_commit":"a51329a55f02ee3f16218c25ed5ee57b44cfc954"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ycm-core/ycmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Fycmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Fycmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Fycmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Fycmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ycm-core","download_url":"https://codeload.github.com/ycm-core/ycmd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycm-core%2Fycmd/sbom","scorecard":{"id":1238253,"data":{"date":"2025-08-25","repo":{"name":"github.com/ycm-core/ycmd","commit":"9160b4eee67ea61c8501bad36d061bcec5340021"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":3.3,"checks":[{"name":"Code-Review","score":7,"reason":"Found 12/17 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"Maintained","score":2,"reason":"3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: COPYING.txt:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: COPYING.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:88: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:132: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:143: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:148: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:198: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:203: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:216: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:230: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:244: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:249: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:255: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:275: update your workflow using https://app.stepsecurity.io/secureworkflow/ycm-core/ycmd/ci.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:120","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:170","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:262","Info:   0 out of  15 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-167 / GHSA-6pc9-xqrg-wfqw","Warn: Project is vulnerable to: PYSEC-2023-242 / GHSA-8r96-8889-qg2x","Warn: Project is vulnerable to: PYSEC-2022-34 / GHSA-9w4w-cpc8-h2fq","Warn: Project is vulnerable to: PYSEC-2019-23 / GHSA-xjjg-vmw6-c2p9","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: PYSEC-2015-17 / GHSA-pg2w-x9wp-vw92","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2013-22 / GHSA-27x4-j476-jp5f","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2022-43012 / GHSA-r9hx-vwmv-q579","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: RUSTSEC-2020-0095","Warn: Project is vulnerable to: RUSTSEC-2022-0013 / GHSA-m5pq-gvj9-9vr8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-09-27T23:26:32.484Z","repository_id":17067629,"created_at":"2025-09-27T23:26:32.485Z","updated_at":"2025-09-27T23:26:32.485Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27768415,"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","status":"online","status_checked_at":"2025-12-16T02:00:10.477Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["code-analysis","code-completion","editor","semantic-engine"],"created_at":"2024-07-31T05:00:55.247Z","updated_at":"2025-12-16T16:47:03.357Z","avatar_url":"https://github.com/ycm-core.png","language":"C++","readme":"ycmd: a code-completion \u0026 comprehension server\n==============================================\n\n[![Build status](https://dev.azure.com/YouCompleteMe/YCM/_apis/build/status/ycm-core.ycmd?branchName=master)](https://dev.azure.com/YouCompleteMe/YCM/_build/latest?definitionId=4\u0026branchName=master)\n[![Coverage status](https://img.shields.io/codecov/c/github/ycm-core/ycmd/master.svg)](https://codecov.io/gh/ycm-core/ycmd)\n\nycmd is a server that provides APIs for code-completion and other\ncode-comprehension use-cases like semantic GoTo commands (and others). For\ncertain filetypes, ycmd can also provide diagnostic errors and warnings.\n\nycmd was originally part of [YouCompleteMe][ycm]'s codebase, but has been split\nout into a separate project so that it can be used in editors other than Vim.\n\nCheck [the API documentation][api-docs] if you want to implement a client. A\ngood way to learn how to interact with ycmd is by reading through (and running)\nthe [`example_client.py`][example-client] file. See the [README for the\nexamples][example-readme] folder for details on how to run the example client.\n\nKnown ycmd clients:\n------------------\n\n- [YouCompleteMe][ycm]: Vim client, stable and exposes all ycmd features.\n- [emacs-ycmd][]: Emacs client.\n- [you-complete-me][atom-you-complete-me]: Atom client.\n- [YcmdCompletion][sublime-ycmd-completion]: Sublime client\n- [sublime-ycmd][sublime-ycmd]: Sublime Text 3 client.\n- [kak-ycmd][]: Kakoune client.\n- [you-complete-me][vscode-you-complete-me]: VSCode client.\n- [gycm][]: Geany client.\n- [nano-ycmd][]: GNU nano client.\n\nFeel free to send a pull request adding a link to your client here if you've\nbuilt one.\n\nBuilding\n--------\n**If you're looking to develop ycmd, see the [instructions for running the\ntests][test-setup].**\n\nThis is all for Ubuntu Linux. Details on getting ycmd running on other OS's can\nbe found in [YCM's instructions][ycm-install] (ignore the Vim-specific parts).\nNote that **ycmd runs on Python 3.8.0+.**\n\nFirst, install the minimal dependencies:\n```\nsudo apt install build-essential cmake python3-dev\n```\n\nNext, install the language specific dependencies you need:\n- `sudo apt install golang-go` for Go.\n- `sudo apt install npm` for JavaScript and TypeScript.\n- `sudo apt install mono-devel` for C#.\n- `sudo apt install openjdk-8-jre` for Java.\n\nWhen you first clone the repository you'll need to update the submodules:\n```\ngit submodule update --init --recursive\n```\n\nThen run `python3 build.py --all` or any of the specific completers listed by\n`python3 build.py --help`. This should get you going.\n\nFor more detailed instructions on building ycmd, see [YCM's\ninstructions][ycm-install] (ignore the Vim-specific parts).\n\nSupported compilers\n-------------------\n\n- GCC 8 and later\n- Clang 7 and later\n- Microsoft Visual Studio 2017 v 15.7 and later\n\nAPI notes\n---------\n\n- All strings going into and out of the server are UTF-8 encoded.\n- All lines end with `\\n`.\n- All line and column numbers are 1-based, not 0-based. They are also byte\n  offsets, _not_ Unicode codepoint offsets.\n- All file paths are full, absolute paths.\n- All requests to the server _must_ include an [HMAC][] in the `x-ycm-hmac` HTTP\n  header. The HMAC is computed from the shared secret passed to the server on\n  startup and the request/response body. The digest algorithm is SHA-256. The\n  server will also include the HMAC in its responses; you _must_ verify it\n  before using the response. See [`example_client.py`][example-client] to see\n  how it's done.\n- API is documented in swagger and published on [the website][api-docs].\n\nHow ycmd works\n--------------\n\nThere are several completion engines in ycmd. The most basic one is an\nidentifier-based completer that collects all of the identifiers in the file\nprovided in the completion request, other files of the same filetype that were\nprovided previously and any tags files produced by ctags. This engine is\nnon-semantic.\n\nThere are also several semantic engines in YCM. There's [clangd][clangd]-based\ncompleter that both provide semantic completion for C-family languages.\nThere's also a Jedi-based completer for semantic completion for Python, an\nOmniSharp-based completer for C#, a [gopls][gopls]-based completer for Go\n(using [gopls][gopls] for jumping to definitions), a TSServer-based completer\nfor JavaScript and TypeScript, a [jdt.ls][jdtls]-based server for Java, and a\n[RLS][]-based completer for Rust.  More will be added with time.\n\n\nThere are also other completion engines, like the filepath completer (part of\nthe identifier completer).\n\nThe server will automatically detect which completion engine would be the best\nin any situation. On occasion, it queries several of them at once, merges the\noutputs and presents the results.\n\nSemantic engines are triggered only after semantic \"triggers\" are inserted in\nthe code. If the request received shows that the user's cursor is after the last\ncharacter in `string foo; foo.` in a C# file, this would trigger the semantic\nengine to\nexamine members of `foo` because `.` is a [default semantic\ntrigger][trigger-defaults] for C# (triggers can be changed dynamically). If the\ntext were `string foo; foo.zoo`, semantic completion would still be triggered\n(the trigger is behind the `zoo` word the user is typing) and the results would\nbe filtered with the `zoo` query.\n\nSemantic completion can also be forced by setting `force_semantic: true` in\nthe JSON data for the completion request, _but you should only do this if the\nuser explicitly requested semantic completion with a keyboard shortcut_;\notherwise, leave it up to ycmd to decide when to use which engine.\n\nThe reason why semantic completion isn't always used even when available is\nbecause the semantic engines can be slow and because most of the time, the\nuser doesn't actually need semantic completion.\n\nThere are two main use-cases for code-completion:\n\n1. The user knows which name they're looking for, they just don't want to type\n   the whole name.\n2. The user either doesn't know the name they need or isn't sure what the name\n   is. This is also known as the \"API exploration\" use-case.\n\nThe first use case is the most common one and is trivially addressed with the\nidentifier completion engine (which BTW is blazing fast). The second one needs\nsemantic completion.\n\n### Completion string filtering\n\nA critical thing to note is that the completion **filtering is NOT based on\nthe input being a string prefix of the completion** (but that works too). The\ninput needs to be a _[subsequence][] match_ of a completion. This is a fancy way\nof saying that any input characters need to be present in a completion string in\nthe order in which they appear in the input. So `abc` is a subsequence of\n`xaybgc`, but not of `xbyxaxxc`.\n\n### Completion string ranking\n\nThe subsequence filter removes any completions that do not match the input, but\nthen the sorting system kicks in. It's a bit involved, but roughly speaking\n\"word boundary\" (WB) subsequence character matches are \"worth\" more than non-WB\nmatches. In effect, this means given an input of \"gua\", the completion\n\"getUserAccount\" would be ranked higher in the list than the \"Fooguxa\"\ncompletion (both of which are subsequence matches). A word-boundary character\nare all capital characters, characters preceded by an underscore and the first\nletter character in the completion string.\n\n### Auto-shutdown if no requests for a while\n\nIf the server hasn't received any requests for a while (controlled by the\n`--idle_suicide_seconds` ycmd flag), it will shut itself down. This is useful\nfor cases where the process that started ycmd dies without telling ycmd to die\ntoo or if ycmd hangs (this should be extremely rare).\n\nIf you're implementing a client for ycmd, ensure that you have some sort of\nkeep-alive background thread that periodically pings ycmd (just call the\n`/healthy` handler, although any handler will do).\n\nYou can also turn this off by passing `--idle_suicide_seconds=0`, although that\nisn't recommended.\n\n### Exit codes\n\nDuring startup, ycmd attempts to load the `ycm_core` library and exits with one\nof the following return codes if unsuccessful:\n\n- 3: unexpected error while loading the library;\n- 4: the `ycm_core` library is missing;\n- 7: the version of the `ycm_core` library is outdated.\n- 8: server is started with python; recompile with python3.\n\nUser-level customization\n-----------------------\n\nYou can provide settings to ycmd on server startup. There's a\n[`default_settings.json`][def-settings] file that you can tweak. See the\n[_Options_ section in YCM's _User Guide_][options] for a description on what\neach option does. Pass the path to the modified settings file to ycmd as an\n`--options_file=/path/to/file` flag.  Note that you must set the `hmac_secret`\nsetting (encode the value with [base64][]). Because the file you are passing\ncontains a secret token, ensure that you are creating the temporary file in a\nsecure way (the [`mkstemp()`][mkstemp] Linux system call is a good idea; use\nsomething similar for other OS's).\n\nAfter it starts up, ycmd will _delete_ the settings file you provided after\nit reads it.\n\nThe settings file is something your editor should produce based on values your\nuser has configured. There's also an extra file (`.ycm_extra_conf.py`) your user\nis supposed to provide to configure certain semantic completers. More\ninformation on it can also be found in the [corresponding section of YCM's _User\nGuide_][extra-conf-doc].\n\n### `.ycm_extra_conf.py` specification\n\nThe `.ycm_extra_conf.py` module may define the following functions:\n\n#### `Settings( **kwargs )`\n\nThis function allows users to configure the language completers on a per project\nbasis or globally. Currently, it is required by the libclang-based completer and\noptional for other completers. The following arguments can be retrieved from\nthe `kwargs` dictionary and are common to all completers:\n\n- `language`: an identifier of the completer that called the function. Its value\n  is `python` for the Python completer and `cfamily` for the C-family completer.\n  This argument is useful to configure several completers at once. For\n  instance:\n\n  ```python\n  def Settings( **kwargs ):\n    language = kwargs[ 'language' ]\n    if language == 'cfamily':\n      return {\n        # Settings for the libclang and clangd-based completer.\n      }\n    if language == 'python':\n      return {\n        # Settings for the Python completer.\n      }\n    return {}\n  ```\n\n- `filename`: absolute path of the file currently edited.\n\n- `client_data`: any additional data supplied by the client application.\n  See the [YouCompleteMe documentation][extra-conf-vim-data-doc] for an\n  example.\n\nThe return value is a dictionary whose content depends on the completer.\n\n#### LSP based completers\n\nLSP servers often support user configuration via the initialise request. These\nare usually presented as options in the UI. Ycmd supports this using the\n`.ycm_extra_conf.py` by allowing the user to specify the exact dictionary of\nsettings that are passed in the server initialise message. These options are\nreturned from `Settings` under the `ls` key. The python dictionary is converted\nto json and included verbatim in the LSP initialize request. In order to\ndetermine the set of options for a server, consult the server's documentation or\n`package.json` file.\nA `config_sections` object is a dictionary whose keys are \"sections\" and values\nare pieces of settings (usually found in the `ls` object) corresponding to\nthose sections. This is even more underspecified and requires trial and error\nto make it work. It is optional and only useful if you explicitly enable\n`workspace/configuration` support.\n\nExample of LSP configuration:\n```python\ndef Settings( **kwargs ):\n  if kwargs[ 'language' ] == 'java':\n    return { 'ls': { 'java.rename.enabled' : False },\n             # `config_sections` is not used for java...\n             'config_sections': { 'section0': {} }\n```\n\nIn addition, ycmd can use any language server, given a file type and a command\nline. A user option `language_server` can be used to plug in a LSP server ycmd\nwouldn't usually know about. The value is a list of dictionaries containing:\n\n- `name`: the string representing the name of the server\n- `cmdline`: the list representing the command line to execute the server\n  (optional; mandatory if port not specified)\n- `port`: optional. If specified, a TCP connection is used to this port. If set\n  to `*`, an unused locall port is selected and made availble in the `cmdline`\n  as `${port}` (see below examples).\n- `filetypes`: list of supported filetypes.\n- `project_root_files`: Tells ycmd which files indicate project root.\n- `capabilities'`: Overrides the default LSP capabilities of ycmd.\n  - If you enable `workspace/configuration` support, check the extra conf\n    details, relevant to LSP servers.\n- `additional_workspace_dirs`: Specifies statically known workspaces that should\n  be open on LSP server startup.\n- `triggerCharacters`: Override the LSP server's trigger characters for\n  completion. This can be useful when the server obnoxiously requests completion\n  on every character or for example on whitespace characters.\n\n```json\n{\n  \"language_server\": [ {\n    \"name\": \"gopls\",\n    \"cmdline\": [ \"/path/to/gopls\", \"-rpc.trace\" ],\n    \"filetypes\": [ \"go\" ],\n    \"project_root_files\": [ \"go.mod\" ],\n    \"triggerCharacters\": [ \".\" ]\n  } ]\n}\n```\n\nOr, to use a TCP connection:\n\n```json\n{\n  \"language_server\": [ {\n    \"name\": \"godot\",\n    \"port\": \"6008\",\n    \"filetypes\": [ \"gdscript\" ]\n  } ]\n}\n```\n\nOr, to use an unused  local port, set `port` to `*` and use `${port}` in the\n`cmdline`:\n\n```json\n{\n  \"language_server\": [ {\n    \"name\": \"someserver\",\n    \"cmdline\": [ \"/path/to/some/server\", \"--port\", \"${port}\" ],\n    \"port\": \"*\",\n    \"filetypes\": [ \"somethign\" ],\n    \"project_root_files\": [ \"somethingfile\" ]\n  } ]\n}\n```\n\n\nWhen plugging in a completer in this way, the `kwargs[ 'language' ]` will be set\nto the value of the `name` key, i.e. `gopls` in the above example.\n\nA number of LSP completers are currently supported without `language_server`,\nusch as:\n\n- Java\n- Rust\n- Go\n- C-family\n\nOne can also override the root directory, with `project_directory`.\n\n```python\ndef Settings( **kwargs ):\n  return { 'project_directory': 'src/' } # The path may be absolute as well.\n```\n\nNote: If an LSP based completer is configured for a language that's supported\n\"built-in\", it overrides the built-in support.\n\n##### C-family settings\n\nThe `Settings` function is called by the libclang and clangd-based completers to\nget the compiler flags to use when compiling the current file. The absolute path\nof this file is accessible under the `filename` key of the `kwargs` dictionary.\n\nThe return value expected by both completers is a dictionary containing the\nfollowing items:\n\n- `flags`: (mandatory for libclang, optional for clangd) a list of compiler\n  flags.\n\n- `include_paths_relative_to_dir`: (optional) the directory to which the include\n  paths in the list of flags are relative. Defaults to ycmd working directory\n  for the libclang completer and `.ycm_extra_conf.py`'s directory for the\n  clangd completer.\n\n- `do_cache`: (optional) a boolean indicating whether or not the result of\n  this call (i.e. the list of flags) should be cached for this file name.\n  Defaults to `True`. If unsure, the default is almost always correct.\n\nThe libclang-based completer also supports the following items:\n\n- `override_filename`: (optional) a string indicating the name of the file to\n  parse as the translation unit for the supplied file name. This fairly advanced\n  feature allows for projects that use a 'unity'-style build, or for header\n  files which depend on other includes in other files.\n\n- `flags_ready`: (optional) a boolean indicating that the flags should be\n  used. Defaults to `True`. If unsure, the default is almost always correct.\n\nA minimal example which simply returns a list of flags is:\n\n```python\ndef Settings( **kwargs ):\n  return {\n    'flags': [ '-x', 'c++' ]\n  }\n```\n\n##### Formatting settings\n\nThe configuration for `Format` subcommand can be specified with an extra conf for\n[the java subserver][jdtls] and for the typescript subserver.\nThe formatter options can be found below:\n\n- [Java configuration][jdt-formatter]\n- [TSServer configuration][ts-formatter],\n\nThese servers support custom formatting options to be supplied in a different\nway than the rest.  For this purpose the `Settings` function can return a\n`formatter` property.\n\nAn example of the formatter configuration would be:\n\n```python\ndef Settings( **kwargs ):\n  return {\n    'formatting_options': {\n       'org.eclipse.jdt.core.formatter.lineSplit': 30, \n    }\n  }\n```\n\n##### Python settings\n\nThe `Settings` function allows users to specify the Python interpreter and\nthe `sys.path` used by the completer to provide completion and code\ncomprehension. No additional arguments are passed.\n\nThe return value expected by the completer is a dictionary containing the\nfollowing items:\n\n- `interpreter_path`: (optional) path to the Python interpreter. `~` and\n  environment variables in the path are expanded. If not an absolute path, it\n  will be searched through the `PATH`.\n\n- `sys_path`: (optional) list of paths prepended to `sys.path`.\n\nUsage example:\n\n```python\ndef Settings( **kwargs ):\n  return {\n    'interpreter_path': '~/project/virtual_env/bin/python',\n    'sys_path': [ '~/project/third_party/module' ]\n  }\n```\n\n#### `PythonSysPath( **kwargs )`\n\nOptional for Python support.\n\nThis function allows further customization of the Python path `sys.path`. Its\nparameters are the possible items returned by the `Settings` function for the\nPython completer:\n\n- `interpreter_path`: path to the Python interpreter.\n\n- `sys_path`: list of Python paths from `sys.path`.\n\nThe return value should be the modified list of Python paths.\n\nSee [ycmd's own `.ycm_extra_conf.py`][ycmd-extra-conf] for an example.\n\n### Global extra conf file specification\n\nThe global extra module must expose the same functions as the\n`.ycm_extra_conf.py` module with the following additions:\n\n#### `YcmCorePreLoad()`\n\nOptional.\n\nThis method, if defined, is called by the server prior to importing the c++\npython plugin. It is not usually required and its use is for advanced users\nonly.\n\n#### `Shutdown()`\n\nOptional.\n\nCalled prior to the server exiting cleanly. It is not usually required and its\nuse is for advanced users only.\n\nBackwards compatibility\n-----------------------\n\nycmd's HTTP+JSON interface follows [SemVer][]. While ycmd has seen extensive use\nover the last several years as part of YCM, the version number is below 1.0\nbecause some parts of the API _might_ change slightly as people discover\npossible problems integrating ycmd with other editors. In other words, the\ncurrent API might unintentionally be Vim-specific. We don't want that.\n\nNote that ycmd's internal API's (i.e. anything other than HTTP+JSON) are **NOT**\ncovered by SemVer and _will_ randomly change underneath you. **DON'T** interact\nwith the Python/C++/etc code directly!\n\nFAQ\n---\n\n### Is HMAC auth for requests/responses really necessary?\n\nWithout the HMAC auth, it's possible for a malicious website to impersonate the\nuser. Don't forget that evil.com can send requests to servers listening on\nlocalhost if the user visits evil.com in a browser.\n\n**This is not merely a theoretical concern**; a working proof-of-concept remote\ncode execution exploit [was created][exploit] for ycmd running on localhost. The\nHMAC auth was added to block this attack vector.\n\n\nContributor Code of Conduct\n---------------------------\n\nPlease note that this project is released with a [Contributor Code of\nConduct][ccoc]. By participating in this project you agree to abide by its\nterms.\n\nContact\n-------\n\nIf you have questions about the plugin or need help, please use the\n[ycmd-users][] mailing list.\n\nThe author's homepage is \u003chttp://val.markovic.io\u003e.\n\nLicense\n-------\n\nThis software is licensed under the [GPL v3 license][gpl].\n© 2015-2019 ycmd contributors\n\n[ycmd-users]: https://groups.google.com/forum/?hl=en#!forum/ycmd-users\n[ycm]: http://ycm-core.github.io/YouCompleteMe/\n[atom-you-complete-me]: https://atom.io/packages/you-complete-me\n[sublime-ycmd-completion]: https://packagecontrol.io/packages/YcmdCompletion\n[sublime-ycmd]: https://packagecontrol.io/packages/YouCompleteMe\n[semver]: http://semver.org/\n[hmac]: http://en.wikipedia.org/wiki/Hash-based_message_authentication_code\n[exploit]: https://groups.google.com/d/topic/ycm-users/NZAPrvaYgxo/discussion\n[example-client]: https://github.com/ycm-core/ycmd/blob/master/examples/example_client.py\n[example-readme]: https://github.com/ycm-core/ycmd/blob/master/examples/README.md\n[trigger-defaults]: https://github.com/ycm-core/ycmd/blob/master/ycmd/completers/completer_utils.py#L143\n[subsequence]: http://en.wikipedia.org/wiki/Subsequence\n[ycm-install]: https://github.com/ycm-core/YouCompleteMe/blob/master/README.md#mac-os-x\n[def-settings]: https://github.com/ycm-core/ycmd/blob/master/ycmd/default_settings.json\n[base64]: http://en.wikipedia.org/wiki/Base64\n[mkstemp]: http://man7.org/linux/man-pages/man3/mkstemp.3.html\n[options]: https://github.com/ycm-core/YouCompleteMe#options\n[extra-conf-doc]: https://github.com/ycm-core/YouCompleteMe#c-family-semantic-completion\n[emacs-ycmd]: https://github.com/abingham/emacs-ycmd\n[gpl]: http://www.gnu.org/copyleft/gpl.html\n[kak-ycmd]: https://github.com/mawww/kak-ycmd\n[ccoc]: https://github.com/ycm-core/ycmd/blob/master/CODE_OF_CONDUCT.md\n[dev-setup]: https://github.com/ycm-core/ycmd/blob/master/DEV_SETUP.md\n[test-setup]: https://github.com/ycm-core/ycmd/blob/master/TESTS.md\n[extra-conf-vim-data-doc]: https://github.com/ycm-core/YouCompleteMe#the-gycm_extra_conf_vim_data-option\n[vscode-you-complete-me]: https://marketplace.visualstudio.com/items?itemName=RichardHe.you-complete-me\n[gycm]: https://github.com/jakeanq/gycm\n[nano-ycmd]: https://github.com/orsonteodoro/nano-ycmd\n[jdtls]: https://github.com/eclipse/eclipse.jdt.ls\n[jdt-formatter]: https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/.settings/org.eclipse.jdt.core.prefs\n[ts-formatter]: https://github.com/Microsoft/TypeScript/blob/master/lib/protocol.d.ts#L2384-L2421\n[api-docs]: https://ycm-core.github.io/ycmd/\n[ycmd-extra-conf]: https://github.com/ycm-core/ycmd/blob/master/.ycm_extra_conf.py\n[clangd]: https://clang.llvm.org/extra/clangd.html\n[gopls]: https://github.com/golang/tools/\n[RLS]: https://github.com/rust-lang-nursery/rls\n","funding_links":[],"categories":["C++","Python","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++","计算机编程_数据结构与算法"],"sub_categories":["资源传输下载"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycm-core%2Fycmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fycm-core%2Fycmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycm-core%2Fycmd/lists"}