Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install YcmdCompletion in Sublime

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how Sublime installs YcmdCompletion. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Below by the sublime tutorials column to introduce Sublime installation YcmdCompletion records, I hope to help friends in need!

Sublime installation YcmdCompletion record

YcmdCompletion is a semantic completion plug-in based on Clang, which installs client and server.

1. Install the client

Search Package Control and select YcmdCompletion.

two。 Install the server

There are two ways to start the server, manual and automatic.

2.1 manually:

Compile the ycmd service, which needs to be compiled on the corresponding platform, he will download some libraries such as clang. Compilation method original text

Install compilation tools

Sudo apt-get install build-essential cmake python-dev

Download the ycmd source code, I download the code directly to the sublime User directory, build will automatically download the clang library.

Cd. Config/sublime-text-3/Usergit clone git@github.com:Valloric/ycmd.git & & cd ycmdgit submodule update-- init-- recursive./build.py-- all

About half an hour, the installation is successful, the author updates more frequently, now the compilation will only generate a library, ycm_core.so, there was a ycm_client_support.so before, and now it has been merged.

Next, start the server manually (note that the current directory is always in the ycmd directory). The server needs a configuration file ycmd/default_settings.json to start, which will be deleted automatically after each startup, so let's make a copy to the current directory first.

Cp ycmd/default_settings.json.

Then open it to modify the two items, global_ycm_extra_conf specifies the default location of. Ycm_extra_conf.py and hmac_secret sets the key of HMAC.

Default .ycm_extra_conf.py download, which is used to configure the settings of the completion feature. For more information, please see the .ycm _ extra_conf.py configuration in the document.

Wget https://raw.githubusercontent.com/Valloric/ycmd/master/cpp/ycm/.ycm_extra_conf.py

Generate HMAC key

Command Palette > Ycmd: Create HMAC keys

The server is written in python, so there is a _ _ main__.py file under ycmd/ycmd, and we can start it.

Python ycmd-port 8888-options_file ycmd/default_settings.json

The server has been started. Next, configure the sublime-text client, open the Ycmd configuration file Preferences > Package Settings > YcmdCompletion > Settings-Default, and modify the ycmd_port port.

The biggest advantage of this approach is that the server can be deployed remotely or made into a Docker image, and you can use it as long as you specify ip and port.

2.2 automatic mode

Open the configuration file Preferences > Package Settings > YcmdCompletion > Settings-Default of Ycmd, and set three parameters.

/ * = YCMD AUTO START MODE = * / "use_auto_start_localserver": 1, "ycmd_path": "/ home/will/.config/sublime-text-3/Packages/User/ycmd/ycmd", "python_binary_path": "/ usr/bin/python", 3. Start Sublime for testing

Set the completion trigger rule, open Preferences-> Settings-More-> Syntax Specific-User, and insert the following code. In this way, when you enter,::,->, you can trigger automatic completion. I have added /, which can trigger path completion, otherwise you need to enter matching characters to complete.

{"auto_complete_selector": "source-(comment, string.quoted)", "auto_complete_triggers": [{"selector": "source.c++", "characters": "."}, {"selector": "source.c++", "characters": ":"}, {"selector": "source.c++", "characters": "- >"} {"selector": "source.c++", "characters": "/"}]}

List of ycmd commands, including restarting the server, displaying the error list, etc.

Command Palette > Ycmd: thank you for reading! This is the end of this article on "how to install YcmdCompletion in Sublime". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report