diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b4f61..0191fff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.9.0 +- Add Terraform support + ## 1.8.0 - Add julia support (txh to [sbromberger](https://github.com/sbromberger)) diff --git a/README.md b/README.md index 8d72b60..c390ffd 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ SQL | mysql,sqlite,psql | dash.docset.sql Stylus | stylus | dash.docset.stylus | [link](https://marketplace.visualstudio.com/items?itemName=sysoev.language-stylus) Swift | swift,iphoneos,macosx,watchos,tvos,appledoc | dash.docset.swift | [link](https://marketplace.visualstudio.com/items?itemName=rlovelett.vscode-swift-language) Tcl | tcl | dash.docset.tcl | [link](https://marketplace.visualstudio.com/items?itemName=rashwell.tcl) +Terraform | terraform | dash.docset.terraform | [link](https://marketplace.visualstudio.com/items?itemName=mauve.terraform) TypeScript | typescript | dash.docset.typescript YAML | chef,ansible | dash.docset.yaml diff --git a/package.json b/package.json index f51a519..6a474fe 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,7 @@ "type": "git", "url": "https://github.com/deerawan/vscode-dash" }, - "categories": [ - "Other" - ], + "categories": ["Other"], "activationEvents": [ "onCommand:extension.dash.all", "onCommand:extension.dash.specific", @@ -32,8 +30,7 @@ ], "main": "./out/src/extension", "contributes": { - "commands": [ - { + "commands": [{ "command": "extension.dash.specific", "title": "Search in Dash for current selection" }, @@ -50,8 +47,7 @@ "title": "Search in Dash for a custom string" } ], - "keybindings": [ - { + "keybindings": [{ "command": "extension.dash.specific", "key": "ctrl+h", "mac": "ctrl+h", @@ -100,18 +96,14 @@ "items": { "type": "string" }, - "default": [ - "clojure" - ] + "default": ["clojure"] }, "dash.docset.coffee": { "type": "array", "items": { "type": "string" }, - "default": [ - "coffee" - ] + "default": ["coffee"] }, "dash.docset.cpp": { "type": "array", @@ -134,77 +126,56 @@ "items": { "type": "string" }, - "default": [ - "net", - "mono", - "unity3d" - ] + "default": ["net", "mono", "unity3d"] }, "dash.docset.dart": { "type": "array", "items": { "type": "string" }, - "default": [ - "dartlang", - "polymerdart", - "angulardart" - ] + "default": ["dartlang", "polymerdart", "angulardart"] }, "dash.docset.elixir": { "type": "array", "items": { "type": "string" }, - "default": [ - "elixir" - ] + "default": ["elixir"] }, "dash.docset.elm": { "type": "array", "items": { "type": "string" }, - "default": [ - "elm" - ] + "default": ["elm"] }, "dash.docset.erlang": { "type": "array", "items": { "type": "string" }, - "default": [ - "erlang" - ] + "default": ["erlang"] }, "dash.docset.go": { "type": "array", "items": { "type": "string" }, - "default": [ - "go", - "godoc" - ] + "default": ["go", "godoc"] }, "dash.docset.haskell": { "type": "array", "items": { "type": "string" }, - "default": [ - "haskell" - ] + "default": ["haskell"] }, "dash.docset.haml": { "type": "array", "items": { "type": "string" }, - "default": [ - "haml" - ] + "default": ["haml"] }, "dash.docset.html": { "type": "array", @@ -246,9 +217,7 @@ "items": { "type": "string" }, - "default": [ - "jade" - ] + "default": ["jade"] }, "dash.docset.java": { "type": "array", @@ -322,9 +291,7 @@ "items": { "type": "string" }, - "default": [ - "react" - ] + "default": ["react"] }, "dash.docset.julia": { "type": "array", @@ -340,28 +307,21 @@ "items": { "type": "string" }, - "default": [ - "less" - ] + "default": ["less"] }, "dash.docset.lua": { "type": "array", "items": { "type": "string" }, - "default": [ - "lua", - "corona" - ] + "default": ["lua", "corona"] }, "dash.docset.markdown": { "type": "array", "items": { "type": "string" }, - "default": [ - "markdown" - ] + "default": ["markdown"] }, "dash.docset.objective-c": { "type": "array", @@ -387,10 +347,7 @@ "items": { "type": "string" }, - "default": [ - "perl", - "manpages" - ] + "default": ["perl", "manpages"] }, "dash.docset.php": { "type": "array", @@ -429,18 +386,14 @@ "items": { "type": "string" }, - "default": [ - "processing" - ] + "default": ["processing"] }, "dash.docset.puppet": { "type": "array", "items": { "type": "string" }, - "default": [ - "puppet" - ] + "default": ["puppet"] }, "dash.docset.python": { "type": "array", @@ -468,84 +421,56 @@ "items": { "type": "string" }, - "default": [ - "r" - ] + "default": ["r"] }, "dash.docset.ruby": { "type": "array", "items": { "type": "string" }, - "default": [ - "ruby", - "rubygems", - "rails" - ] + "default": ["ruby", "rubygems", "rails"] }, "dash.docset.rust": { "type": "array", "items": { "type": "string" }, - "default": [ - "rust" - ] + "default": ["rust"] }, "dash.docset.sass": { "type": "array", "items": { "type": "string" }, - "default": [ - "sass", - "compass", - "bourbon", - "neat", - "susy", - "css" - ] + "default": ["sass", "compass", "bourbon", "neat", "susy", "css"] }, "dash.docset.scala": { "type": "array", "items": { "type": "string" }, - "default": [ - "scala", - "akka", - "playscala" - ] + "default": ["scala", "akka", "playscala"] }, "dash.docset.shellscript": { "type": "array", "items": { "type": "string" }, - "default": [ - "bash", - "manpages" - ] + "default": ["bash", "manpages"] }, "dash.docset.sql": { "type": "array", "items": { "type": "string" }, - "default": [ - "mysql", - "sqlite", - "psql" - ] + "default": ["mysql", "sqlite", "psql"] }, "dash.docset.stylus": { "type": "array", "items": { "type": "string" }, - "default": [ - "stylus" - ] + "default": ["stylus"] }, "dash.docset.swift": { "type": "array", @@ -566,38 +491,35 @@ "items": { "type": "string" }, - "default": [ - "tcl" - ] + "default": ["tcl"] }, "dash.docset.typescript": { "type": "array", "items": { "type": "string" }, - "default": [ - "typescript", - "javascript" - ] + "default": ["typescript", "javascript"] }, "dash.docset.yaml": { "type": "array", "items": { "type": "string" }, - "default": [ - "chef", - "ansible" - ] + "default": ["chef", "ansible"] }, "dash.docset.haxe": { "type": "array", "items": { "type": "string" }, - "default": [ - "haxe" - ] + "default": ["haxe"] + }, + "dash.docset.terraform": { + "type": "array", + "items": { + "type": "string" + }, + "default": ["terraform"] } } } @@ -628,13 +550,7 @@ "vscode": "0.10.x" }, "lint-staged": { - "*.{ts,json}": [ - "prettier", - "git add" - ], - "*.ts": [ - "tslint --fix", - "tslint" - ] + "*.{ts,json}": ["prettier", "git add"], + "*.ts": ["tslint --fix", "tslint"] } } diff --git a/src/dash.ts b/src/dash.ts index 11816d8..4f193a6 100644 --- a/src/dash.ts +++ b/src/dash.ts @@ -23,7 +23,7 @@ export class Dash { */ getCommand(query: string, docsets: string[] = []): string { let uri = 'dash-plugin://query=' + encodeURIComponent(query); - let keys = this.getKeys(docsets); + const keys = this.getKeys(docsets); if (keys) { uri += '&keys=' + keys; diff --git a/src/extension.ts b/src/extension.ts index 186aaae..556eb2e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -43,12 +43,12 @@ export function activate(context: ExtensionContext) { * Search in dash for selection syntax documentation */ function searchSpecific() { - let editor = getEditor(); - let query = getSelectedText(editor); - let languageId = editor.document.languageId; - let docsets = getDocsets(languageId); + const editor = getEditor(); + const query = getSelectedText(editor); + const languageId = editor.document.languageId; + const docsets = getDocsets(languageId); - let dash = new Dash(OS); + const dash = new Dash(OS); exec(dash.getCommand(query, docsets)); } @@ -57,9 +57,9 @@ function searchSpecific() { * Search in dash for all documentation */ function searchAll() { - let editor = getEditor(); - let query = getSelectedText(editor); - let dash = new Dash(OS); + const editor = getEditor(); + const query = getSelectedText(editor); + const dash = new Dash(OS); exec(dash.getCommand(query)); } @@ -68,11 +68,11 @@ function searchAll() { * Search in dash for editor syntax documentation */ function searchEmptySyntax() { - let editor = getEditor(); - let query = ''; - let languageId = editor.document.languageId; - let docsets = getDocsets(languageId); - let dash = new Dash(OS); + const editor = getEditor(); + const query = ''; + const languageId = editor.document.languageId; + const docsets = getDocsets(languageId); + const dash = new Dash(OS); exec(dash.getCommand(query, docsets)); } @@ -81,12 +81,12 @@ function searchEmptySyntax() { * Search in dash for editor syntax documentation with a custom query */ function searchCustomWithSyntax() { - let editor = getEditor(); - let languageId = editor.document.languageId; - let docsets = getDocsets(languageId); - let dash = new Dash(OS); + const editor = getEditor(); + const languageId = editor.document.languageId; + const docsets = getDocsets(languageId); + const dash = new Dash(OS); - let inputOptions: InputBoxOptions = { + const inputOptions: InputBoxOptions = { placeHolder: 'Something to search in Dash.', prompt: 'Enter something to search for in Dash.', }; @@ -105,7 +105,7 @@ function searchCustomWithSyntax() { * @return {TextEditor} */ function getEditor(): TextEditor { - let editor = window.activeTextEditor; + const editor = window.activeTextEditor; if (!editor) { return; } @@ -120,11 +120,11 @@ function getEditor(): TextEditor { * @return {string} */ function getSelectedText(editor: TextEditor) { - let selection = editor.selection; + const selection = editor.selection; let text = editor.document.getText(selection); if (!text) { - let range = editor.document.getWordRangeAtPosition(selection.active); + const range = editor.document.getWordRangeAtPosition(selection.active); text = editor.document.getText(range); } @@ -138,7 +138,7 @@ function getSelectedText(editor: TextEditor) { * @return {Array} */ function getDocsets(languageId: string): Array { - let config = workspace.getConfiguration('dash.docset'); + const config = workspace.getConfiguration('dash.docset'); if (config[languageId]) { return config[languageId]; diff --git a/test/extension.test.ts b/test/extension.test.ts index 5473056..938becc 100644 --- a/test/extension.test.ts +++ b/test/extension.test.ts @@ -3,22 +3,22 @@ import { Dash } from '../src/dash'; suite('Dash Tests', () => { test('Get command with keys for macOS', () => { - let dash = new Dash('darwin'); - let uri = dash.getCommand('size', ['css', 'less']); + const dash = new Dash('darwin'); + const uri = dash.getCommand('size', ['css', 'less']); assert.equal(uri, 'open -g "dash-plugin://query=size&keys=css,less"'); }); test('Get command with no keys for macOS', () => { - let dash = new Dash('darwin'); - let uri = dash.getCommand('size'); + const dash = new Dash('darwin'); + const uri = dash.getCommand('size'); assert.equal(uri, 'open -g "dash-plugin://query=size"'); }); test('Get command with keys for Windows', () => { - let dash = new Dash('win32'); - let uri = dash.getCommand('size', ['css', 'less']); + const dash = new Dash('win32'); + const uri = dash.getCommand('size', ['css', 'less']); assert.equal( uri, @@ -27,36 +27,36 @@ suite('Dash Tests', () => { }); test('Get command with no keys for Windows', () => { - let dash = new Dash('win32'); - let uri = dash.getCommand('size'); + const dash = new Dash('win32'); + const uri = dash.getCommand('size'); assert.equal(uri, 'start dash-plugin:// && start dash-plugin://query=size'); }); test('Get command with keys for Linux', () => { - let dash = new Dash('linux'); - let uri = dash.getCommand('size', ['css', 'less']); + const dash = new Dash('linux'); + const uri = dash.getCommand('size', ['css', 'less']); assert.equal(uri, 'zeal "dash-plugin://query=size&keys=css,less"'); }); test('Get command with no keys for Linux', () => { - let dash = new Dash('linux'); - let uri = dash.getCommand('size'); + const dash = new Dash('linux'); + const uri = dash.getCommand('size'); assert.equal(uri, 'zeal "dash-plugin://query=size"'); }); test('Get keys with exist docset', () => { - let dash = new Dash('darwin'); - let keys = dash.getKeys(['css', 'less']); + const dash = new Dash('darwin'); + const keys = dash.getKeys(['css', 'less']); assert.equal(keys, 'css,less'); }); test('Get keys with empty docset', () => { - let dash = new Dash('darwin'); - let keys = dash.getKeys([]); + const dash = new Dash('darwin'); + const keys = dash.getKeys([]); assert.equal(keys, ''); }); diff --git a/tslint.json b/tslint.json index 75c9086..4deb1d0 100644 --- a/tslint.json +++ b/tslint.json @@ -1,101 +1,58 @@ { - "jsRules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-duplicate-variable": true, - "no-eval": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "double" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - }, - "rules": { - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "indent": [ - true, - "spaces" - ], - "no-eval": true, - "no-internal-module": true, - "no-trailing-whitespace": true, - "no-unsafe-finally": true, - "no-var-keyword": true, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "quotemark": [ - true, - "single" - ], - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } + "jsRules": { + "class-name": true, + "comment-format": [true, "check-space"], + "indent": [true, "spaces"], + "no-duplicate-variable": true, + "no-eval": true, + "no-trailing-whitespace": true, + "no-unsafe-finally": true, + "one-line": [true, "check-open-brace", "check-whitespace"], + "quotemark": [true, "double"], + "semicolon": [true, "always"], + "triple-equals": [true, "allow-null-check"], + "variable-name": [true, "ban-keywords"], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ] + }, + "rules": { + "class-name": true, + "comment-format": [true, "check-space"], + "indent": [true, "spaces"], + "no-eval": true, + "no-internal-module": true, + "no-trailing-whitespace": true, + "no-unsafe-finally": true, + "no-var-keyword": true, + "prefer-const": true, + "one-line": [true, "check-open-brace", "check-whitespace"], + "quotemark": [true, "single"], + "semicolon": [true, "always"], + "triple-equals": [true, "allow-null-check"], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "variable-name": [true, "ban-keywords"], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ] + } }