[clangd-vscode] NFC; Improve wording in documentation and update VSCode tasks

Summary:
VSCode tasks are updated to the latest supported versions: deprecated
values are removed and replaced by their new counterparts.

Reviewers: hokein

Reviewed By: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76595
This commit is contained in:
Kirill Bobyrev 2020-04-01 14:16:21 +02:00
parent 2effe8f5e7
commit db3d64eebb
5 changed files with 29 additions and 27 deletions

View File

@ -1,4 +1,4 @@
// A launch configuration that compiles the extension and then opens it inside a new window // A launch configuration that compiles extension and opens it inside a new window.
{ {
"version": "0.1.0", "version": "0.1.0",
"configurations": [ "configurations": [

View File

@ -6,25 +6,27 @@
// ${fileExtname}: the current opened file's extension // ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process // ${cwd}: the current working directory of the spawned process
// A task runner that calls a custom npm script that compiles the extension. // Task runner calls custom npm script to compile the extension.
{ {
"version": "0.1.0", "version": "2.0.0",
// we want to run npm // Run NPM.
"command": "npm", "command": "npm",
// the command is a shell script // This command is a shell script.
"isShellCommand": true, "type": "shell",
// show the output window only if unrecognized errors occur. // show the output window only if unrecognized errors occur.
"showOutput": "silent", "presentation": {
"reveal": "silent",
},
// we run the custom script "compile" as defined in package.json // Run custom "compile" script as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"], "args": ["run", "compile", "--loglevel", "silent"],
// The tsc compiler is started in watching mode // tsc compiler is kept alive and runs in the background.
"isWatching": true, "isBackground": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output. // Find compilation problems in the output through tsc in watch mode.
"problemMatcher": "$tsc-watch" "problemMatcher": "$tsc-watch"
} }

View File

@ -10,20 +10,20 @@ A guide of developing `vscode-clangd` extension.
## Steps ## Steps
1. Make sure you disable the installed `vscode-clangd` extension in VS Code. 1. Make sure you disable the installed `vscode-clangd` extension in VS Code.
2. Make sure you have clangd in /usr/bin/clangd or edit src/extension.ts to 2. Make sure you have clangd in `/usr/bin/clangd` or edit `src/extension.ts` to
point to the binary. point to the binary.
3. In order to start a development instance of VS code extended with this, run: 3. To start a development instance of VS code extended with this, run:
```bash ```bash
$ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/ $ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/
$ npm install $ npm install
$ code . $ code .
# When VS Code starts, press <F5>. # When VSCode starts, press <F5>.
``` ```
# Contributing # Contributing
Please follow the exsiting code style when contributing to the extension, we Please follow the existing code style when contributing to the extension, we
recommend to run `npm run format` before sending a patch. recommend to run `npm run format` before sending a patch.
# Publish to VS Code Marketplace # Publish to VS Code Marketplace
@ -38,15 +38,15 @@ to the marketplace.
* Bump the version in `package.json`, and commit the change to upstream * Bump the version in `package.json`, and commit the change to upstream
The extension is published under `llvm-vs-code-extensions` account, which is The extension is published under `llvm-vs-code-extensions` account, which is
currently maintained by clangd developers. If you want to make a new release, maintained by clangd developers. If you want to make a new release, please
please contact clangd-dev@lists.llvm.org. contact clangd-dev@lists.llvm.org.
## Steps ## Steps
```bash ```bash
$ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/ $ cd /path/to/clang-tools-extra/clangd/clients/clangd-vscode/
# For the first time, you need to login in the account. vsce will ask you for # For the first time, you need to login into the account. vsce will ask you
the Personal Access Token, and remember it for future commands. for the Personal Access Token and will remember it for future commands.
$ vsce login llvm-vs-code-extensions $ vsce login llvm-vs-code-extensions
# Publish the extension to the VSCode marketplace. # Publish the extension to the VSCode marketplace.
$ npm run publish $ npm run publish

View File

@ -3,7 +3,7 @@ import * as vscodelc from 'vscode-languageclient';
import * as semanticHighlighting from './semantic-highlighting'; import * as semanticHighlighting from './semantic-highlighting';
/** /**
* Method to get workspace configuration option * Get an option from workspace configuration.
* @param option name of the option (e.g. for clangd.path should be path) * @param option name of the option (e.g. for clangd.path should be path)
* @param defaultValue default value to return if option is not set * @param defaultValue default value to return if option is not set
*/ */
@ -75,8 +75,8 @@ class EnableEditsNearCursorFeature implements vscodelc.StaticFeature {
} }
/** /**
* this method is called when your extension is activate * This method is called when the extension is activated. The extension is
* your extension is activated the very first time the command is executed * activated the very first time a command is executed.
*/ */
export function activate(context: vscode.ExtensionContext) { export function activate(context: vscode.ExtensionContext) {
const syncFileEvents = getConfig<boolean>('syncFileEvents', true); const syncFileEvents = getConfig<boolean>('syncFileEvents', true);
@ -97,7 +97,7 @@ export function activate(context: vscode.ExtensionContext) {
documentSelector: [ documentSelector: [
{ scheme: 'file', language: 'c' }, { scheme: 'file', language: 'c' },
{ scheme: 'file', language: 'cpp' }, { scheme: 'file', language: 'cpp' },
// cuda is not supported by vscode, but our extension does. // CUDA is not supported by vscode, but our extension does supports it.
{ scheme: 'file', language: 'cuda' }, { scheme: 'file', language: 'cuda' },
{ scheme: 'file', language: 'objective-c'}, { scheme: 'file', language: 'objective-c'},
{ scheme: 'file', language: 'objective-cpp'} { scheme: 'file', language: 'objective-cpp'}
@ -106,7 +106,7 @@ export function activate(context: vscode.ExtensionContext) {
// FIXME: send sync file events when clangd provides implementations. // FIXME: send sync file events when clangd provides implementations.
}, },
initializationOptions: { clangdFileStatus: true }, initializationOptions: { clangdFileStatus: true },
// Do not switch to output window when clangd returns output // Do not switch to output window when clangd returns output.
revealOutputChannelOn: vscodelc.RevealOutputChannelOn.Never, revealOutputChannelOn: vscodelc.RevealOutputChannelOn.Never,
// We hack up the completion items a bit to prevent VSCode from re-ranking them // We hack up the completion items a bit to prevent VSCode from re-ranking them
@ -126,7 +126,7 @@ export function activate(context: vscode.ExtensionContext) {
provideCompletionItem: async (document, position, context, token, next) => { provideCompletionItem: async (document, position, context, token, next) => {
let list = await next(document, position, context, token); let list = await next(document, position, context, token);
let items = (Array.isArray(list) ? list : list.items).map(item => { let items = (Array.isArray(list) ? list : list.items).map(item => {
// Gets the prefix used by vscode when doing fuzzymatch. // Gets the prefix used by VSCode when doing fuzzymatch.
let prefix = document.getText(new vscode.Range(item.range.start, position)) let prefix = document.getText(new vscode.Range(item.range.start, position))
if (prefix) if (prefix)
item.filterText = prefix + "_" + item.filterText; item.filterText = prefix + "_" + item.filterText;

View File

@ -26,4 +26,4 @@
"node_modules", "node_modules",
".vscode-test" ".vscode-test"
] ]
} }