Coder Social home page Coder Social logo

microsoft / vscode-extension-samples Goto Github PK

View Code? Open in Web Editor NEW
8.1K 177.0 3.3K 99.86 MB

Sample code illustrating the VS Code extension API.

License: MIT License

TypeScript 82.71% JavaScript 13.67% Rust 0.70% Shell 0.05% CSS 1.76% HTML 0.24% Jupyter Notebook 0.80% Batchfile 0.07%

vscode-extension-samples's Introduction

VS Code Extension Samples

This repository contains sample code illustrating the VS Code extension API. Each sample is a self-contained extension that explains one topic in VS Code API or VS Code's Contribution Points. You can read, play with or adapt from these samples to create your own extensions.

You can expect from each sample:

  • An explanation of its functionality
  • A gif or screenshot demonstrating its usage
  • Link to a guide on VS Code website, if it has one
  • Listing of used VS Code API and Contribution Points
  • Code of the same style, enforced using ESLint

Prerequisites

You need to have node and npm installed on your system to run the examples. It is recommended to use the node version used for VS Code development itself which is documented here

Usage

  • git clone https://github.com/Microsoft/vscode-extension-samples
  • code <any-sample-folder>
  • npm install in the terminal, then F5 to run the sample
  • Alternatively, follow the instructions in each sample's README for setting up and running the sample

Getting Started

Samples

Sample Guide on VS Code Website API & Contribution
Webview Sample /api/extension-guides/webview window.createWebviewPanel
window.registerWebviewPanelSerializer
Webview View Sample N/A window.registerWebviewViewProvider
Webview Codicons Sample N/A
Status Bar Sample N/A window.createStatusBarItem
StatusBarItem
Tree View Sample /api/extension-guides/tree-view window.createTreeView
window.registerTreeDataProvider
TreeView
TreeDataProvider
contributes.views
contributes.viewsContainers
Task Provider Sample /api/extension-guides/task-provider tasks.registerTaskProvider
Task
ShellExecution
contributes.taskDefinitions
Multi Root Sample N/A workspace.getWorkspaceFolder
workspace.onDidChangeWorkspaceFolders
Completion Provider Sample N/A languages.registerCompletionItemProvider
CompletionItem
SnippetString
Code Actions Sample N/A languages.registerCodeActionsProvider
CodeActionProvider
File System Provider Sample N/A workspace.registerFileSystemProvider
Editor Decorator Sample N/A TextEditor.setDecorations
DecorationOptions
DecorationInstanceRenderOptions
ThemableDecorationInstanceRenderOptions
window.createTextEditorDecorationType
TextEditorDecorationType
contributes.colors
L10n Sample N/A
Terminal Sample N/A window.createTerminal
window.onDidChangeActiveTerminal
window.onDidCloseTerminal
window.onDidOpenTerminal
window.Terminal
window.terminals
Extension Terminal Sample N/A window.createTerminal
window.Pseudoterminal
window.ExtensionTerminalOptions
Color Theme Sample /api/extension-guides/color-theme contributes.themes
Product Icon Theme Sample /api/extension-guides/product-icon-theme contributes.productIconThemes
Vim Sample N/A commands
StatusBarItem
window.createStatusBarItem
TextEditorCursorStyle
window.activeTextEditor
Position
Range
Selection
TextEditor
TextEditorRevealType
TextDocument
webpack-sample N/A
Source Control Sample /api/extension-guides/scm-provider workspace.workspaceFolders
SourceControl
SourceControlResourceGroup
scm.createSourceControl
TextDocumentContentProvider
contributes.menus
Commenting API Sample N/A
Document Editing Sample N/A commands
Custom Data Sample /api/extension-guides/custom-data-extension
CodeLens Provider Sample N/A languages.registerCodeLensProvider
CodeLensProvider
CodeLens
Call Hierarchy Sample N/A languages.registerCallHierarchyProvider
CallHierarchyProvider
CallHierarchyItem
CallHierarchyOutgoingCall
CallHierarchyIncomingCall
Custom Editors Sample /api/extension-guides/custom-editors window.registerCustomEditorProvider
CustomTextEditorProvider
contributes.customEditors
Semantic tokens /api/language-extensions/semantic-highlight-guide languages.registerDocumentSemanticTokensProvider
vscode.DocumentSemanticTokensProvider
Test Provider Sample N/A
Getting Started Sample N/A
notebook-renderer-sample /api/extension-guides/notebook#notebook-renderer contributes.notebookRenderer
notebook-extend-markdown-renderer-sample /api/extension-guides/notebook#notebook-renderer contributes.notebookRenderer

Language Server Protocol Samples

Sample Guide on VS Code Website API & Contribution
Snippet Sample /api/language-extensions/snippet-guide contributes.snippets
Language Configuration Sample /api/language-extensions/language-configuration-guide contributes.languages
LSP Sample /api/language-extensions/language-server-extension-guide
LSP Log Streaming Sample N/A
LSP Multi Root Server Sample https://github.com/Microsoft/vscode/wiki/Extension-Authoring:-Adopting-Multi-Root-Workspace-APIs#language-client--language-server
LSP Web Extension Sample /api/language-extensions/language-server-extension-guide

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

vscode-extension-samples's People

Contributors

aeschli avatar ahmadawais avatar alexdima avatar alexr00 avatar bpasero avatar chrisdias avatar chrmarti avatar connor4312 avatar daviddossett avatar dbaeumer avatar dependabot[bot] avatar donjayamanne avatar egamma avatar fcrespo82 avatar hediet avatar isidorn avatar jan-dolejsi avatar joaomoreno avatar jrieken avatar lramos15 avatar mavaddat avatar mjbvz avatar octref avatar rebornix avatar roblourens avatar rzhao271 avatar sandy081 avatar tanhakabir avatar tylerleonhardt avatar tyriar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-extension-samples's Issues

Problems running the lsp-sample

  • VSCode Version: 1.16.1, x64,
  • OS Version: Windows 7, x64

Should the values for "preLaunchTask" in the launch.json be "watch:client" (same for server) instead of "Client Watch?

I can start the sample extension, but I can't attach to the server. Does this have something to do with the switch from legacy to inspector? No code or configuration (besides the preLaunchTasks) have been changed.

Error message (translated from German): No connection to runtime. Make sure that debug modus has been set to legacy. (it is)

Type error in lsp-sample/server/src/server.ts

I got this error running npm compile

server/src/server.ts(29,138): error TS2339: Property 'publishDiagnostics' does not exist on type 'TextDocumentClientCapabilities'.
server/src/server.ts(29,194): error TS2339: Property 'publishDiagnostics' does not exist on type 'TextDocumentClientCapabilities'.
server/src/server.ts(90,15): error TS2339: Property 'relatedInformation' does not exist on type 'Diagnostic'.

I found that it is a problem with the version of its dependencies.

Update the dependency vscode-languageserver in lsp-sample/server/package.json to the latest version v4.1.2 can fix this.

Hope to fix it :)

Update tree-view-sample to use custom view container

I think it would be neat to include an addition to this sample to show off how to use the Custom views Container feature being added in the April 2018 release of VSCode. I made the change locally which is just moving the views to a new view container and then add that view onto the activity bar. Would this be something people are interested in having on this sample?

[tree-explorer] is there a way to customize node ?

Abilitity to have some icons, tooltip or give basic label text styles - italic, bold are the one I'm looking after.

What's the proposal for context menu ? invoke an action with a quick pick ? Or do you have anything in mind ?

lsp-sample npm run compile error

node version: 8.3.0
npm run compile error:
โžœ lsp-sample git:(master) โœ— npm run compile

[email protected] compile /Users/panda/workspace/dianwoda/framework-vscode-extension/framework-intellisense/example/lsp-sample
tsc -p client/tsconfig.json && cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json

[email protected] installServer /Users/panda/workspace/dianwoda/framework-vscode-extension/framework-intellisense/example/lsp-sample/server
installServerIntoExtension ../client ./package.json ./tsconfig.json

Copying package.json to extension's server location...
Updating server npm modules into extension's server location...
server/src/server.ts(25,5): error TS6133: 'workspaceRoot' is declared but its value is never read.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] compile: tsc -p client/tsconfig.json && cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/panda/.npm/_logs/2017-11-09T14_58_14_572Z-debug.log

Sample request: diagnostics without a language server

I'm working on an extension where I'd like to display some diagnostics (red squiggles) for certain JSON documents. I'm having trouble finding documentation or samples for the createDiagnosticCollection API. (I don't want to implement a full language server because (a) these are JSON documents and (b) it's too much work for the small thing I want to do). There is an example at https://github.com/hoovercj/vscode-extension-tutorial but it seems to involve a surprising amount of wiring up document event handlers, and requires some additional poking and prodding to make it display diagnostics on documents that are open at startup - so it doesn't feel like this is the intended usage.

It would be great if a sample could be added that shows how to create diagnostics.

If it would help, I can send a pull request containing a simple sample based on what I have at the moment, and then you folks can review it into the ground... grin

vim vg$ only moved the selection, it does not select

From @sandy081 on July 27, 2016 10:50

From @Tyriar on July 26, 2016 17:31

  • VSCode Version: Code - Insiders 1.4.0-insider (fc167f86c1aee27951b7d4b4db51229f62d0a0ad, 2016-07-26T05:12:44.554Z)
  • OS Version: Linux x64 4.4.0-28-generic, Ubuntu 16.04
    #9699

Steps to Reproduce:

  1. Open a file
  2. Go to the middle of a line with content
  3. Type "vg$", notice the cursor is only moved, no selection

Copied from original issue: microsoft/vscode#9803

Copied from original issue: microsoft/vscode-samples#8

"No handler found" error in contentprovider extension

I copied contentprovider-sample as is to my .vscode/extensions folder and when trying to run, I get:

No handler found for the command: 'editor.printReferences'. An extension might be missing an activation event.

Tree Explorer & View stability status

In the Readme, it lists Tree Explorer as Experimental, but I am seeing quite a few popular extensions (Azure Functions, GitLens, etc.) integrating views into their extensions so would it still be experimental because at least from someone who is just seeing this repo, they may possibly think that it isn't a stable feature when it seems to be quite fleshed out now.

Error running npm install in lsp-sample

I got error when running npm install
Environment

  • windows 10 x64
  • Node v8.7.0
  • npm v5.8.0
$ npm install

> [email protected] postinstall F:\Project\other\vscode-extension-samples\lsp-sample
> cd server && npm install && cd ../client && npm install && cd ..

added 5 packages from 2 contributors in 0.591s

> [email protected] postinstall F:\Project\other\vscode-extension-samples\lsp-sample\client
> node ./node_modules/vscode/bin/install

Detected VS Code engine version: ^1.16.0
Error installing vscode.d.ts: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 1080 1080:80
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node ./node_modules/vscode/bin/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Sardi\AppData\Roaming\npm-cache\_logs\2018-04-14T15_06_43_604Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `cd server && npm install && cd ../client && npm install && cd ..`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Sardi\AppData\Roaming\npm-cache\_logs\2018-04-14T15_06_43_669Z-debug.log

2018-04-14T15_06_43_604Z-debug.log
2018-04-14T15_06_43_669Z-debug.log

vim vg0, vg^ and vg$ should include the character at the end of the line in the selection

From @Tyriar on July 26, 2016 17:26

  • VSCode Version: Code - Insiders 1.4.0-insider (fc167f86c1aee27951b7d4b4db51229f62d0a0ad, 2016-07-26T05:12:44.554Z)
  • OS Version: Linux x64 4.4.0-28-generic, Ubuntu 16.04
    #9699

Not sure if this is an extension, sample extension or API issue?

Steps to Reproduce:

  1. Open a file
  2. Go to a line with content
  3. end
  4. Type vg0, notice the character at the end is not included in the selection (unlike when running vim)
    image

And

  1. Go to beginning 0
  2. Type vg$, notice that character at the end is not included

And

  1. Go to beginning 0
  2. Type vg_, notice that non white space character at the end is included, BUT, cursor position is on next character

Copied from original issue: microsoft/vscode#9802

multi-diagnostic-sample: relatedInformation diagnostic error

Visual Studio Code
Version 1.22.2
Commit 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
Date 2018-04-12T16:38:45.278Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

Steps:

  • Clone repository
  • Open multi-diagnostic-sample folder in Visual Studio code
  • Press F5 to launch debugger or open src/extension.ts and wait for TypeScript Intellisense to kick-in

Expected: extension to run without problems
Actual: error message is shown

Argument of type '{ code: string; message: string; range: Range; severity: DiagnosticSeverity.Error; source: string...' is not assignable to parameter of type 'Diagnostic[]'.
Type '{ code: string; message: string; range: Range; severity: DiagnosticSeverity.Error; source: string...' is not assignable to type 'Diagnostic'.
Object literal may only specify known properties, and 'relatedInformation' does not exist in type 'Diagnostic'.

vscode-multi-diagnostic-sample-error

Cannot run the Vim sample

Hi, encountering an error with controller.ts when i try to run it:
image

Error:
Type 'PromiseLike<Promise>' is not assignable to type 'Thenable'.
Types of property 'then' are incompatible.
Type '<TResult1 = Promise, TResult2 = never>(onfulfilled?: (value: Promise) =...' is not assignable to type '<TResult1 = ITypeResult, TResult2 = never>(onfulfilled?: (value: ITypeResult) => TResult1 | Promi...'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'Promise' is not assignable to type 'ITypeResult'.
Property 'hasConsumedInput' is missing in type 'Promise'.

I understand this sample was for version 0.10.12 and the version i'm using is:
Version 1.23.1
Commit d0182c3417d225529c6d5ad24b7572815d0de9ac
Date 2018-05-10T17:11:17.614Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

So it's possible the API is no longer the same between versions? A fix or help to resolve this so that i may study and debug it further to make my own modal style keyboard would be greatly appreciated!

Installation problems

Hi @sandy081

I tried to install the tree-sample in VS Code Insider and got some issues with that... I hope you can give me some advice.

Thanx in advance...
Raydir

When i run npm install from withing VS Code terminal i get the following errors:

npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users<myUserName>\AppData\Roaming\npm-cache_logs\2018-04-12T04_09_16_266Z-debug.log


Content:

...
143 silly saveTree   `-- [email protected]
144 warn [email protected] No repository field.
145 warn [email protected] No license field.
146 verbose stack TypeError: Cannot read property '0' of undefined
146 verbose stack     at rmStuff (C:\Program Files\nodejs\node_modules\npm\lib\unbuild.js:61:24)
146 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
146 verbose stack     at ret (eval at makeNodePromisifiedEval (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promisify.js:184:12), <anonymous>:13:39)
146 verbose stack     at lifecycle.then.then (C:\Program Files\nodejs\node_modules\npm\lib\install\action\unbuild.js:12:12)
146 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
146 verbose stack     at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
146 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
146 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
146 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
146 verbose stack     at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
146 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\nodeback.js:42:21
146 verbose stack     at <anonymous>
147 verbose cwd C:\Users\romanvonwil\.vscode-insiders\extensions\tree-view-sample
148 verbose Windows_NT 10.0.16299
149 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
150 verbose node v8.11.1
151 verbose npm  v5.6.0
152 error Cannot read property '0' of undefined
153 verbose exit [ 1, true ]

Pull request title incorrect

When creating a pull request the last commit message is taken as the PR title instead of the title I added during the "Create PR" process.

To recreate:

  • Create branch
  • Make change
  • Commit and publish to remote
  • Click "Create PR" button in VSCode
  • Select repo
  • Select branch to which PR will be created
  • Add PR title
  • Go to GitHub pull requests and see that the title is actually the commit message from the last commit made on branch

npm failed to install lsp-multi-root-example modules

I'm having problems with the multi-root language server on Ubuntu 16.04 running VSCode 1.8.1. When I ran "npm install" inside the lsp-multi-root-example folder, I received an error during execution. Here's a snapshot of the console where this problem occured:

vscode-multirootserver-npmerror

The breaking point was
> node ./node_modules/vscode/bin/install

Apparently, when I tried installing node, Linux told me that the program was obsolete or outdated and that it didn't have a candidate I could download instead. Could you change this to use nodejs instead of node or some other substitution?

Much appreciated,
Gabe

Example with Thenable for LSP

Hello here!

I am sorry if this is a wrong issue here, but I am unsure where else to create it.

I am trying to implement language server protocol. I got stuck without understanding how to create instance of Thenable type to implement connection.onDocumentFormatting. I have Promise and I am not sure how to go from there.

Can you, please, help me and maybe add some basic implementation reference to the examples?

How to create the i18n folder structure automatically using vscode-nls-dev

@dbaeumer

All localization files are under the i18n folder.
You could have created this folder by hand, or you could have used the vscode-nls-dev tool to extract it.
Under the i18n folder, you have sub-folders that represent the language you want to localize. These names follow the ISO 639-3 convention.

Q1. Looking at the sample https://github.com/Microsoft/vscode-extension-samples/tree/8fb95dc0f72c067579c9aaa63c88129781bebb43/i18n-sample, I'm struggling to understand how the i18n folder structure is created.

Does this have to be created by hand, or can be this automated as described above or you could have used the vscode-nls-dev tool to extract it.

Q2. Please could you provide an example.

If you have a top-level package.nls.json file in your extension, you should have one for each language following the naming convention of package.i18n.json.

Language Server testing example

A while I ago I created a language server for Ember.js projects (https://github.com/emberwatch/ember-language-server). We initially forked the (old) example language server (https://github.com/Microsoft/vscode-languageserver-node-example) and built our LS on top of it. While we gave our best to test the language server, we were always missing basic integration tests. I tried creating integration tests a couple of times but somewhere on the way I always get stuck. I can imagine that this is a major problem for a lot of people that start working with the language server example.
So I think a basic integration test example could improve the language server example in this repository a lot.

What I would like to see in an example test would basically do:

  1. Start the server and connect to it
  2. Send a specified request
  3. Check the response if it is correct

Tree View Sample: Ability to display a badge

Hello,
In the tree-view-sample there's a nice example of how to create e.g. a Refresh button on the tree view.

I'd like to add a badge with a number indicating total count of the items that are stored in my tree.
Similar thing is visible on the "Changes" tree view for VCS:
image

I'm wondering whether it's possible for me to have that too.
I'd appreciate any help.

CC: @sandy081

EDIT: Just found that in the Git extension it's called countBadge:

https://github.com/Microsoft/vscode/blob/master/extensions/git/package.json#L828

Is it exposed somewhere?

Thank you all for the tremendous work!

Multi-server language extension won't build, due to tasks.json issue

When trying to build the lsp-multi-server-example in VS Code, the following messages appear:

Couldn't resolve dependent task 'watch:client' in workspace folder 'lsp-multi-server-sample'
Couldn't resolve dependent task 'watch:server' in workspace folder 'lsp-multi-server-sample'

This appears to be because watch:client and watch:server in vscode-extension-samples/lsp-multi-server-sample/.vscode/tasks.json were changed to npm tasks instead of shell tasks, which changes the signature to npm: watch:client and npm: watch:server.

How to get back the HTML from previewHTML?

I have successfully implemented an interactive network graphic using D3 and the previewHTML feature. This is pretty cool, many thanks for that.

However, how would I read out the generated svg to e.g. to store it on disk? Is it possible to read back what is currently in the preview?

lsp-sample "module not found"

I'm trying to run the example extension, but it seems like context.asAbsolutePath is returning an incorrect path for the server files. The absolute path is */vscode-extension-samples-master/lsp-sample/client/server/server.js' instead of */vscode-extension-samples-master/lsp-sample/server/server.js'.

module.js:472
throw err;
^

Error: Cannot find module '/Users/xxxx/Documents/vscode-extension-samples-master/lsp-sample/client/server/server.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Server. (/Users/yuxinjiang/Documents/vscode-extension-samples-master/lsp-sample/client/node_modules/vscode-languageclient/lib/utils/electronForkStart.js:110:9)
at emitOne (events.js:96:13)
at Server.emit (events.js:191:7)
at Pipe.onconnection (net.js:1486:8)

Error Compiling lsp-sample

npm run compile

produces this log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Development\Libs\nodejs\node.exe',
1 verbose cli 'C:\Development\Libs\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'compile:server' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'precompile:server', 'compile:server', 'postcompile:server' ]
5 info lifecycle [email protected]precompile:server: [email protected]
6 info lifecycle [email protected]
compile:server: [email protected]
7 verbose lifecycle [email protected]compile:server: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
compile:server: PATH: C:\Development\Libs\nodejs\node_modules\npm\bin\node-gyp-bin;c:\Development\Workspace\VsCode\vscode-extension-samples\lsp-sample\node_modules.bin;c:\Development\Workspace\Python\uModules\env\Scripts;c:\Development\Bin;C:\Development\Utils\ConEmu\ConEmuPack.161206\ConEmu\Scripts;C:\Development\Utils\ConEmu\ConEmuPack.161206;C:\Development\Utils\ConEmu\ConEmuPack.161206\ConEmu;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft Emulator Manager\1.0;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\dotnet;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Development\Libs\Java\jre8\bin;C:\Development\Libs\NintendoDevInteface;C:\Program Files\Nintendo\HostBridge;C:\Development\Libs\nodejs;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\paul\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files (x86)\Microsoft VS Code Insiders\bin;C:\Users\paul\AppData\Roaming\npm;;c:\Development\Libs;c:\Development\Libs\Java\jdk1.8\bin;C:\Program Files\Git\cmd;c:\Development\Tools\SQLite;C:\Program Files\Mercurial;C:\Games2\Emulators\Commodore\WinVice\WinVice-3.0.0;C:\Games2\Emulators\Atari\Stella\Stella-2.4.1;c:\Development\Tools\Pico\pico-8_0.1.4d_windows;c:\Development\Tools\Voxatron\voxatron_0.3.4_windows;C:\Games2\Emulators\Atari\z26\z26v3.02.01x;c:\Development\Utils\DoxyGen\1.8.11;c:\Development\Utils\SysInternalsSuite;c:\Development\Tools\6502\Assemblers\acme\acme-0.95;c:\Development\Tools\6502\Assemblers\dasm\dasm-2.20;c:\Development\Tools\6502\Assemblers\kickass\kickass-4.13;c:\Development\Tools\6502\Assemblers\turbo\64tass-1.51.992;;C:\Program Files\opencbm;C:\Games2\Emulators\Mame\Mame183;c:\Progra1\7-ZIP;;c:\Development\Libs\Python\Python35;c:\Development\Libs\Python\Python35\Scripts;
9 verbose lifecycle [email protected]
compile:server: CWD: c:\Development\Workspace\VsCode\vscode-extension-samples\lsp-sample
10 silly lifecycle [email protected]compile:server: Args: [ '/d /s /c',
10 silly lifecycle 'cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json' ]
11 silly lifecycle [email protected]
compile:server: Returned: code: 2 signal: null
12 info lifecycle [email protected]~compile:server: Failed to exec compile:server script
13 verbose stack Error: [email protected] compile:server: cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json
13 verbose stack Exit status 2
13 verbose stack at EventEmitter. (C:\Development\Libs\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (C:\Development\Libs\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd c:\Development\Workspace\VsCode\vscode-extension-samples\lsp-sample
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\Development\Libs\nodejs\node.exe" "C:\Development\Libs\nodejs\node_modules\npm\bin\npm-cli.js" "run" "compile:server"
18 verbose node v8.9.1
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] compile:server: cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json
22 error Exit status 2
23 error Failed at the [email protected] compile:server script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

also tried with node 7.9.0

lsp-sample compilation error

I get this:

$ tsc -p client/tsconfig.json && cd server && npm run installServer && cd .. && tsc -p server/tsconfig.json

> [email protected] installServer /Users/me/workspace/vscode-extension-samples/lsp-sample/server
> installServerIntoExtension ../client ./package.json ./tsconfig.json

Copying package.json to extension's server location...
Updating server npm modules into extension's server location...
server/src/server.ts(25,5): error TS6133: 'workspaceRoot' is declared but its value is never read.

Create a window

Hi, Please tell me how can i create a new window and put a reactjs component on it?
Thanks
From Peter

vscode.TextDocumentContentProvider is undefined

For my extension I am not using TypeScript so I do,

const vscode = require('vscode');
console.log(vscode.TextDocumentContentProvider); // undefined

screenshot

I see it's used like vscode.TextDocumentContentProvider in this line of previewhtml-sample, however I cannot access it. previewhtml-sample's vscode engine is 0.10.7 and current engine is 1.19.0. Is this a breaking change or am I missing something?

Thanks.

Click into terminal created by sample causes Chrome Tools to open.

Hi Guys.

Firstly, nice work. ๐Ÿ‘

So, I ran the sample of terminals and I get a strange behavior, when I create a terminal by the command from plugin and I click to the new terminal, the Chrome Tools starts. I don't know why. If I click in the default terminal it's not occurs.
Any Ideia why this happens?

I created a video to better understand:

terminal

Thanks.

Doc clarification

In this step in the readme, "open this folder in VS Code. In the Debug viewlet, run 'Launch Client' from drop-down to launch the extension and attach to the extension.", please be sure to specify that "this folder" means the client folder. I spent hours trying to debug from the root folder.

Sample request: Using onDidChangeWorkspaceFolders

I'm trying to subscribe to onDidChangeWorkspaceFolders in the server part of my extension.

I changed:

const connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));

To:

const connection = createConnection(ProposedFeatures.all);

To get access to connection.workspace.onDidChangeWorkspaceFolders. I have no idea if that should be done.

Now, when I run the extension, I get:

Error: Client doesn't support sending workspace folder change events.

I have no idea how to fix this. I can't find any relevant samples either.

lsp-sample: does nothing after packaging and installation

I am not sure how or which part of the language server sample is supposed to be packaged. It works great in debugger, but when I package the top level package.json or the ./client/package.json (using vsce package) and install the *.vsix, the extension does not work.
I tried adding the activation event and the configuration sections from the ./client/package.json to the top level, nothing. I tried adding the missing 'engines' to the ./client/package.json ... nothing.
Can you update the sample or readme.md?

Recommended GIF tooling

FOA, thank you for curating very informative documentation suite for VS Code product. I'd like to ask what GIF tooling do you recommend for generating illustrative assets to go with extensions that will land in the Marketplace?

Debugging language servers without legacy protocol

All of the lsp samples still use the legacy debug protocol:

https://github.com/Microsoft/vscode-extension-samples/blob/79892a6eefac3836655386a927044cd15a1e6230/lsp-sample/.vscode/launch.json#L29

This is not working for me with Node 8 installed. Can these be updated?

I tried switching mine to inspector instead of legacy, but I get an error message:

Ensure Node was launched with --inspect. Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:6009).

Where do I specify --inspect in the project?

Error while installing dependencies for tree-view-sample

Step:

  1. go to tree-view-sample folder
  2. run npm install

following error displayed:

Detected VS Code engine version: ^1.13.0
Found minimal version that qualifies engine range: 1.13.0
Fetching vscode.d.ts from: https://raw.githubusercontent.com/Microsoft/vscode/1.13.0/src/vs/vscode.d.ts
Error installing vscode.d.ts: Error: Request returned status code: 404
Details: 404: Not Found

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node ./node_modules/vscode/bin/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

BTY, i have upgraded my vscode to 1.13.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.