Semantic Completion

Semantic completion permits suggestions which make use of language-specific information.

For example, this suggestion requires TabNine to infer that x is a string:

For information about the features TabNine provides once semantic completion is enabled, see this blog post.

TabNine is language agnostic, so it relies on other software to provide semantic completions. Any server which implements the Language Server Protocol can be used as a source of semantic completions.

TabNine comes with default choices of language servers for many common languages. You can also override TabNine's defaults to use a language server of your choice (described later).

To get semantic completion working:

  1. Verify you are running TabNine 1.0.5 or above by typing TabNine::version in your text editor. If you're running an earlier version, try restarting your editor.
  2. Type TabNine::sem to enable semantic completion.
  3. If TabNine notifies you of an error, try installing the semantic completion backend manually by following the link in the table. If you don't see any message, then semantic completion is working.

If the above steps don't work, check that the language server works when you run it in your terminal. If it works in the terminal, but TabNine can't find it, follow these steps:

  1. Assume for the sake of these instructions that you're trying to get go-langserver to work. Use which go-langserver in your terminal to find the absolute path to the language server.
  2. Type TabNine::config_dir in your editor to find your configuration directory.
  3. Find the entry in <config_dir>/ExampleTabNine.toml corresponding to your language. In this case it is:
    command = "go-langserver"
    args = ["-mode", "stdio", "-gocodecompletion"]
    install = [["go", "get", "-u", ""]]
  4. Create a file <config_dir>/TabNine.toml and paste the entry you found above into it, but replace the command field with the absolute path you found in step 1. (If you're on Windows, you'll need to escape the backslashes in the path, for example C:\Users\janedoe should be replaced with C:\\Users\\janedoe.)
  5. Type TabNine::restart into your text editor.

LanguageCommandsProject link
npm install -g typescript-language-server
typescript-language-server --stdio
TypeScript Language Server
npm install -g typescript-language-server
typescript-language-server --stdio
TypeScript Language Server
pip install python-language-server
Python Language Server
C/C++clangd (manual installation)cquery
rustup update
rustup component add rls rust-analysis rust-src
Rust Language Server
go get -u
gopls serve
Go Language Server
gem install solargraph
solargraph stdio
npm install -g vscode-html-languageserver-bin
html-languageserver --stdio
VS Code HTML Language Server
npm install -g ocaml-language-server
ocaml-language-server --stdio
OCaml Language Server
Haskellhie --lsp (manual installation)Haskell IDE Engine
pub global activate dart_language_server
Dart Language Server
npm install -g purescript-language-server
purescript-language-server --stdio
PureScript Language Server
npm install -g vscode-css-languageserver-bin
css-languageserver --stdio
npm install -g vscode-css-languageserver-bin
css-languageserver --stdio

Custom configuration

Create a file called TabNine.toml in your TabNine configuration directory. You can find your TabNine configuration directory by typing TabNine::config_dir into a file while TabNine is running.

Here is an example TabNine.toml which uses ccls for C++ completion rather than the default choice of cquery. It also does the following:

  • Allows TabNine to start 2 language servers to enable prefetching.
  • Configures TabNine to wait for the language server to respond when the user types . (rather than returning TabNine's results immediately and caching the server's response for future requests). This is enabled by default for both . and ::.
  • Waits 200 ms for the language server to respond when the user types . or :: (the default is 50 ms).
  • Prevents TabNine from always preferring language server suggestions over other identifiers.
command = "ccls"
args = ["--init={\"cacheDirectory\":\"${project_root}/.ccls\"}"]
synchronous_triggers = ["."]
synchronous_timeout_ms = 200
num_server_instances = 2
always_prefer = false