Skip to content

Implementation of semantic highlighting #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,988 changes: 964 additions & 1,024 deletions Editors/vscode/package-lock.json

Large diffs are not rendered by default.

147 changes: 75 additions & 72 deletions Editors/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,75 +1,78 @@
{
"name": "sourcekit-lsp",
"displayName": "SourceKit-LSP",
"description": "Language server for Swift and C/C++/Objective-C",
"version": "0.0.1",
"publisher": "unpublished",
"repository": "https://github.com/apple/sourcekit-lsp",
"license": "SEE LICENSE IN LICENSE.txt",
"engines": {
"vscode": "^1.28.0"
},
"categories": [
"Programming Languages"
],
"activationEvents": [
"onLanguage:swift",
"onLanguage:cpp",
"onLanguage:c",
"onLanguage:objective-c",
"onLanguage:objective-cpp"
],
"main": "./out/extension",
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"createDevPackage": "npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix"
},
"dependencies": {
"vscode-languageclient": "^4.0.0"
},
"devDependencies": {
"@types/node": "^8.10.25",
"typescript": "^2.6.1",
"vsce": "^1.53.2",
"vscode": "^1.1.34"
},
"contributes": {
"configuration": {
"type": "object",
"title": "SourceKit-LSP",
"properties": {
"sourcekit-lsp.serverPath": {
"type": "string",
"default": "sourcekit-lsp",
"description": "The path of the sourcekit-lsp executable"
},
"sourcekit-lsp.serverArguments": {
"type": "array",
"default": [],
"items": {
"type": "string"
},
"description": "Arguments to pass to sourcekit-lsp. Argument keys and values should be provided as separate entries in the array e.g. ['--log-level', 'debug']"
},
"sourcekit-lsp.toolchainPath": {
"type": "string",
"default": "",
"description": "(optional) The path of the swift toolchain. By default, sourcekit-lsp uses the toolchain it is installed in."
},
"sourcekit-lsp.trace.server": {
"type": "string",
"default": "off",
"enum": [
"off",
"messages",
"verbose"
],
"description": "Traces the communication between VS Code and the SourceKit-LSP language server."
}
}
"name": "sourcekit-lsp",
"displayName": "SourceKit-LSP",
"description": "Language server for Swift and C/C++/Objective-C",
"version": "0.0.2",
"publisher": "unpublished",
"repository": "https://github.com/apple/sourcekit-lsp",
"license": "SEE LICENSE IN LICENSE.txt",
"enableProposedApi": true,
"engines": {
"vscode": "^1.44.0"
},
"categories": [
"Programming Languages"
],
"activationEvents": [
"onLanguage:swift",
"onLanguage:cpp",
"onLanguage:c",
"onLanguage:objective-c",
"onLanguage:objective-cpp"
],
"main": "./out/extension",
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"download-api": "vscode-dts dev",
"postdownload-api": "vscode-dts master",
"postinstall": "npm run download-api",
"createDevPackage": "npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix"
},
"dependencies": {
"vscode-languageclient": "7.0.0-next.1"
},
"devDependencies": {
"@types/node": "^8.10.25",
"typescript": "^3.8.3",
"vsce": "^1.75.0",
"vscode-dts": "^0.3.1"
},
"contributes": {
"configuration": {
"type": "object",
"title": "SourceKit-LSP",
"properties": {
"sourcekit-lsp.serverPath": {
"type": "string",
"default": "sourcekit-lsp",
"description": "The path of the sourcekit-lsp executable"
},
"sourcekit-lsp.serverArguments": {
"type": "array",
"default": [],
"items": {
"type": "string"
},
"description": "Arguments to pass to sourcekit-lsp. Argument keys and values should be provided as separate entries in the array e.g. ['--log-level', 'debug']"
},
"sourcekit-lsp.toolchainPath": {
"type": "string",
"default": "",
"description": "(optional) The path of the swift toolchain. By default, sourcekit-lsp uses the toolchain it is installed in."
},
"sourcekit-lsp.trace.server": {
"type": "string",
"default": "off",
"enum": [
"off",
"messages",
"verbose"
],
"description": "Traces the communication between VS Code and the SourceKit-LSP language server."
}
}
}
}
}
}
52 changes: 26 additions & 26 deletions Editors/vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@ import * as vscode from 'vscode';
import * as langclient from 'vscode-languageclient';

export function activate(context: vscode.ExtensionContext) {
const config = vscode.workspace.getConfiguration('sourcekit-lsp');

const config = vscode.workspace.getConfiguration('sourcekit-lsp');
const sourcekit: langclient.Executable = {
command: config.get<string>('serverPath', 'sourcekit-lsp'),
args: config.get<string[]>('serverArguments', []),
};

const sourcekit: langclient.Executable = {
command: config.get<string>('serverPath', 'sourcekit-lsp'),
args: config.get<string[]>('serverArguments', [])
const toolchain = config.get<string>('toolchainPath', '');
if (toolchain) {
sourcekit.options = {
env: { ...process.env, SOURCEKIT_TOOLCHAIN_PATH: toolchain },
};
}

const toolchain = config.get<string>('toolchainPath', '');
if (toolchain) {
sourcekit.options = { env: { ...process.env, SOURCEKIT_TOOLCHAIN_PATH: toolchain } };
}

const serverOptions: langclient.ServerOptions = sourcekit;

let clientOptions: langclient.LanguageClientOptions = {
documentSelector: [
'swift',
'cpp',
'c',
'objective-c',
'objective-cpp'
],
synchronize: undefined
};
const serverOptions: langclient.ServerOptions = sourcekit;

const client = new langclient.LanguageClient('sourcekit-lsp', 'SourceKit Language Server', serverOptions, clientOptions);
let clientOptions: langclient.LanguageClientOptions = {
documentSelector: ['swift', 'cpp', 'c', 'objective-c', 'objective-cpp'],
synchronize: undefined,
};

context.subscriptions.push(client.start());
const client = new langclient.LanguageClient(
'sourcekit-lsp',
'SourceKit Language Server',
serverOptions,
clientOptions
);
client.registerProposedFeatures();

console.log('SourceKit-LSP is now active!');
}
context.subscriptions.push(client.start());

export function deactivate() {
console.log('SourceKit-LSP is now active!');
}

export function deactivate() {}
38 changes: 17 additions & 21 deletions Editors/vscode/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "src",
/* Strict Type-Checking Option */
"strict": true, /* enable all strict type-checking options */
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": [
"node_modules",
".vscode-test"
]
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "out",
"skipLibCheck": true,
"lib": ["es6"],
"sourceMap": true,
"rootDir": "src",
/* Strict Type-Checking Option */
"strict": true /* enable all strict type-checking options */,
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
},
"exclude": ["node_modules", ".vscode-test"]
}
Loading