Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dual committed Apr 9, 2020
1 parent 905d945 commit 2cc1bd9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 106 deletions.
67 changes: 2 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,2 @@
# zsh README

This is the README for your extension "zsh". After writing up a brief description, we recommend including the following sections.

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
## Requirements

If you have any requirements or dependencies, add a section describing those and how to install and configure them.

## Extension Settings

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.

For example:

This extension contributes the following settings:

* `myExtension.enable`: enable/disable this extension
* `myExtension.thing`: set to `blah` to do something

## Known Issues

Calling out known issues can help limit users opening duplicate issues against your extension.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of ...

### 1.0.1

Fixed issue #.

### 1.1.0

Added features X, Y, and Z.

-----------------------------------------------------------------------------------------------------------

## Working with Markdown

**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux)
* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets

### For more information

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)

**Enjoy!**
# zsh completion script
detect first line of file, if match `#compdef` or `#autoload`, mark it as `shellscript`
46 changes: 20 additions & 26 deletions extension.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
const vscode = require('vscode');

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed

/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {

// Use the console to output diagnostic information (console.log) and errors (console.error)
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "zsh" is now active!');

// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
let disposable = vscode.commands.registerCommand('zsh.helloWorld', function () {
// The code you place here will be executed every time your command is executed

// Display a message box to the user
vscode.window.showInformationMessage('Hello World from zsh!');
});
function detect() {
if (vscode.window.activeTextEditor.document.languageId != 'plaintext') {
return
}
const line = vscode.window.activeTextEditor.document.lineAt(0).text
if (line && line.match(/^#compdef|^#autoload/)) {
vscode.languages
.setTextDocumentLanguage(vscode.window.activeTextEditor.document, "shellscript")
.catch(err => {
console.error(err)
})
}
}

context.subscriptions.push(disposable);
function activate() {
vscode.window.onDidChangeVisibleTextEditors(() => {
detect()
})
detect()
}

exports.activate = activate;

// this method is called when your extension is deactivated
function deactivate() {}
function deactivate() { }

module.exports = {
activate,
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 9 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
{
"name": "zsh",
"displayName": "zsh",
"description": "",
"version": "0.0.1",
"name": "zsh-completion-script",
"displayName": "zsh completion script detect",
"description": "zsh completion script detect",
"version": "1.0.0",
"publisher": "dual",
"icon": "icon.png",
"engines": {
"vscode": "^1.43.0"
},
"categories": [
"Other"
"Programming Languages"
],
"activationEvents": [
"onCommand:zsh.helloWorld"
"onLanguage:plaintext"
],
"main": "./extension.js",
"contributes": {
"commands": [
{
"command": "zsh.helloWorld",
"title": "Hello World"
}
]
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
Expand All @@ -37,4 +31,4 @@
"typescript": "^3.8.3",
"vscode-test": "^1.3.0"
}
}
}

0 comments on commit 2cc1bd9

Please sign in to comment.