mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
start completions sample
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
Thumbs.db
|
||||
vim-sample/node_modules
|
||||
vim-sample/out
|
||||
*/node_modules/
|
||||
*/out/
|
||||
|
||||
74
.vscode/launch.json
vendored
74
.vscode/launch.json
vendored
@ -2,15 +2,34 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Completions Sample",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/completions-sample"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/completions-sample/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile-completions"
|
||||
},
|
||||
{
|
||||
"name": "Launch Decorator Sample",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}/decorator-sample" ],
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/decorator-sample"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": ["${workspaceRoot}/decorator-sample/out/**/*.js"],
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/decorator-sample/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile-decorator"
|
||||
},
|
||||
{
|
||||
@ -18,10 +37,14 @@
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}/previewhtml-sample" ],
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/previewhtml-sample"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": ["${workspaceRoot}/previewhtml-sample/out/**/*.js"],
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/previewhtml-sample/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile-previewhtml"
|
||||
},
|
||||
{
|
||||
@ -29,10 +52,14 @@
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}/contentprovider-sample" ],
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/contentprovider-sample"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": ["${workspaceRoot}/contentprovider-sample/out/**/*.js"],
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/contentprovider-sample/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile-contentprovider"
|
||||
},
|
||||
{
|
||||
@ -40,10 +67,14 @@
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}/statusbar-sample" ],
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/statusbar-sample"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": ["${workspaceRoot}/statusbar-sample/out/**/*.js"],
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/statusbar-sample/out/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "compile-statusbar"
|
||||
},
|
||||
{
|
||||
@ -51,10 +82,14 @@
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}/languageprovider-sample" ],
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceRoot}/languageprovider-sample"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": ["${workspaceRoot}/languageprovider-sample/client/out/**/*.js"]
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/languageprovider-sample/client/out/**/*.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Attach Language Provider Sample Server",
|
||||
@ -62,13 +97,18 @@
|
||||
"request": "attach",
|
||||
"port": 6004,
|
||||
"sourceMaps": true,
|
||||
"outFiles": ["${workspaceRoot}/languageprovider-sample/server/out/**/*.js"]
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/languageprovider-sample/server/out/**/*.js"
|
||||
]
|
||||
}
|
||||
],
|
||||
"compounds": [
|
||||
{
|
||||
"name": "Launch Language Provider Sample & Attach to Server",
|
||||
"configurations": ["Launch Language Provider Sample", "Attach Language Provider Sample Server"]
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"name": "Launch Language Provider Sample & Attach to Server",
|
||||
"configurations": [
|
||||
"Launch Language Provider Sample",
|
||||
"Attach Language Provider Sample Server"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
33
.vscode/tasks.json
vendored
33
.vscode/tasks.json
vendored
@ -5,85 +5,76 @@
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
|
||||
// A task runner that calls a custom npm script that compiles the extension.
|
||||
{
|
||||
"version": "0.1.0",
|
||||
|
||||
// we want to run 'npm run'
|
||||
"command": "npm",
|
||||
"args": [
|
||||
"run"
|
||||
],
|
||||
|
||||
// the command is a shell script
|
||||
"isShellCommand": true,
|
||||
|
||||
"tasks": [
|
||||
{
|
||||
// in package.json we have a compile task for each example
|
||||
"taskName": "compile-decorator",
|
||||
|
||||
"taskName": "compile-completions",
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
// in package.json we have a compile task for each example
|
||||
"taskName": "compile-decorator",
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
// in package.json we have a compile task for each example
|
||||
"taskName": "compile-previewhtml",
|
||||
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
// in package.json we have a compile task for each example
|
||||
"taskName": "compile-statusbar",
|
||||
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
// in package.json we have a compile task for each example
|
||||
"taskName": "compile-contentprovider",
|
||||
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
},
|
||||
{
|
||||
// in package.json we have a compile task for each example
|
||||
"taskName": "compile-languageprovider",
|
||||
|
||||
// show the output window only if unrecognized errors occur.
|
||||
"showOutput": "silent",
|
||||
|
||||
// The tsc compiler is started in watching mode
|
||||
"isWatching": true,
|
||||
|
||||
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
|
||||
"problemMatcher": "$tsc-watch"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
1
completions-sample/README.md
Normal file
1
completions-sample/README.md
Normal file
@ -0,0 +1 @@
|
||||
# Completion Item Provider Sample
|
||||
28
completions-sample/package.json
Normal file
28
completions-sample/package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "completions-sample",
|
||||
"displayName": "Completion Item Provider Sample",
|
||||
"version": "0.0.1",
|
||||
"publisher": "jrieken",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/vscode-extension-samples"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode-extension-samples/issues"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.5.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"*"
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"devDependencies": {
|
||||
"typescript": "^2.1.4",
|
||||
"vscode": "^1.0.0",
|
||||
"@types/node": "^6.0.40"
|
||||
}
|
||||
}
|
||||
19
completions-sample/src/extension.ts
Normal file
19
completions-sample/src/extension.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/*---------------------------------------------------------
|
||||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*--------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
// The most simple completion item provider which
|
||||
// * registers for text files (`'plaintext'`), and
|
||||
// * only return the 'Hello World' completion
|
||||
vscode.languages.registerCompletionItemProvider('plaintext', {
|
||||
provideCompletionItems() {
|
||||
return [new vscode.CompletionItem('Hello World')];
|
||||
}
|
||||
});
|
||||
}
|
||||
15
completions-sample/tsconfig.json
Normal file
15
completions-sample/tsconfig.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"outDir": "out",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@ -4,6 +4,7 @@
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"postinstall": "node .build/postinstall.js",
|
||||
"compile-completions": "cd completions-sample && tsc",
|
||||
"compile-decorator": "cd decorator-sample && npm run compile",
|
||||
"compile-previewhtml": "cd previewhtml-sample && npm run compile",
|
||||
"compile-contentprovider": "cd contentprovider-sample && npm run compile",
|
||||
|
||||
Reference in New Issue
Block a user