-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhow-to-work-this.txt
81 lines (52 loc) · 4.21 KB
/
how-to-work-this.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
**** notes about how to work on this extension
- To run the extension, just hit F5 in the VSCode. It will load a new vscode with the extension.
you can "add a folder" that that new window, and use it to manually test the extension.
- I'll add the test feature from https://github.com/avivey/vscode-quick-new-file soon. I've removed the built in test feature because it sucks. Might bring it back if there's some use for it.
- to package it into a VSIX file, run `./node_modules/.bin/vsce package`. VSIX is a zip file, so it can be viewed using this extension.
- API docs for vscode is at https://code.visualstudio.com/api/references/vscode-api
**** Plans
Stuff that needs to happen:
- When clicking a file in the "Explorer" section, if it's a file we want to see, open an editor tab with some text.
- How do we define "a file we want to see"?
- file extension is the easiest
- is there a way to get vscode to ping us for any file that doesn't have a handler already?
- probably want to be able to right-click and select "view archive" for any file in the explorer
- the new editor tab should be read-only
- the text for the editor should be generated by our extension
- to generate the text, we'll need to
(1) identify the file format (see https://www.npmjs.com/package/file-type) and
(2) get a listing of its content (based on the format).
Extra nice stuff:
- make an fancy HTML view of the file, replace editor with WebView (this might be the solution to the read-only part too)
- in linux, use `file` and `lesspipe` programs to view lots of other file formats.
- add test suite of different kinds of archive files.
**** Instructions From the Quickstart
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your extension and command.
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
## Get up and running straight away
* Press `F5` to open a new window with your extension loaded.
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
* Find output from your extension in the debug console.
## Make changes
* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Explore the API
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
## Run tests
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Extension Tests`.
* Press `F5` to run the tests in a new window with your extension loaded.
* See the output of the test result in the debug console.
* Make changes to `src/test/suite/extension.test.ts` or create new test files inside the `test/suite` folder.
* The provided test runner will only consider files matching the name pattern `**.test.ts`.
* You can create folders inside the `test` folder to structure your tests any way you want.
## Go further
* Reduce the extension size and improve the startup time by [bundling your extension](https://code.visualstudio.com/api/working-with-extensions/bundling-extension).
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VSCode extension marketplace.
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).