diff --git a/CHANGELOG.md b/CHANGELOG.md index 2192a07..d340253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.16.1 - April 23, 2018 +- Commands for building gem documentation + ## 0.16.0 - April 16, 2018 - `solargraph.diagnostics` default is false - Updated solargraph-utils diff --git a/README.md b/README.md index 247a8f7..2e27305 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Solargraph is a language server that provides intellisense, code completion, and * Context-aware suggestions and documentation for the Ruby core * Detection of some variable types and method return values (e.g., `String.new.` returns String instance methods) * Identification of local, class, and instance variables within the current scope +* Support for gems * Near-complete support for the Ruby stdlib * Partial support for Ruby on Rails @@ -61,6 +62,11 @@ Hover your mouse over code to see method definitions, return values, and links t To go to a method or variable's definition, right-click and select "Go to Definition" from the context menu, or press F12 for the definition at the cursor. +### Gem Support + +Solargraph is capable of providing code completion and documentation for gems. When your code uses `require` to include a gem, its classes and methods become available in completion and intellisense. + +You can make sure your gems are available with the commands `Build new gem documentation` or `Rebuild all gem documentation` in the command palette. ### Diagnostics (Linting) diff --git a/package.json b/package.json index 34bca92..55b503d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Ruby Solargraph", "description": "Code completion and inline documentation for Ruby", "icon": "solargraph.png", - "version": "0.16.0", + "version": "0.16.1", "publisher": "castwide", "author": { "name": "Fred Snyder" @@ -26,7 +26,6 @@ "autocomplete", "intellisense", "YARD", - "code completion", "language server" ], "engines": { @@ -100,6 +99,16 @@ "command": "solargraph.downloadCore", "title": "Download current Ruby documentation", "category": "Solargraph" + }, + { + "command": "solargraph.buildGemDocs", + "title": "Build new gem documentation", + "category": "Solargraph" + }, + { + "command": "solargraph.rebuildAllGemDocs", + "title": "Rebuild all gem documentation", + "category": "Solargraph" } ], "keybindings": [ diff --git a/src/extension.ts b/src/extension.ts index 1861134..6d929e6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -152,6 +152,44 @@ export function activate(context: ExtensionContext) { }); context.subscriptions.push(disposableSearch); + // Build gem documentation command + var disposableBuildGemDocs = vscode.commands.registerCommand('solargraph.buildGemDocs', () => { + var disposableStatus = vscode.window.setStatusBarMessage('Building new YARD documentation...') + var cmd = solargraph.commands.yardCommand(['gems'], solargraphConfiguration); + cmd.on('exit', (code) => { + disposableStatus.dispose(); + if (code == 0) { + vscode.window.setStatusBarMessage('YARD documentation complete.', 3000); + } else { + vscode.window.setStatusBarMessage('An error occurred during build.', 3000); + } + }); + cmd.on('error', (err) => { + disposableStatus.dispose(); + vscode.window.setStatusBarMessage('Unable to build documentation.', 3000); + }); + }); + context.subscriptions.push(disposableBuildGemDocs); + + // Rebuild gems documentation command + var disposableRebuildAllGemDocs = vscode.commands.registerCommand('solargraph.rebuildAllGemDocs', () => { + var disposableStatus = vscode.window.setStatusBarMessage('Rebuilding all YARD documentation...') + var cmd = solargraph.commands.yardCommand(['gems', '--rebuild'], solargraphConfiguration); + cmd.on('exit', (code) => { + disposableStatus.dispose(); + if (code == 0) { + vscode.window.setStatusBarMessage('YARD documentation rebuild complete.', 3000); + } else { + vscode.window.setStatusBarMessage('An error occurred during rebuild.', 3000); + } + }); + cmd.on('error', (err) => { + disposableStatus.dispose(); + vscode.window.setStatusBarMessage('Unable to rebuild documentation.', 3000); + }); + }); + context.subscriptions.push(disposableRebuildAllGemDocs); + solargraph.verifyGemIsInstalled(solargraphConfiguration).then((result) => { if (result) { console.log('The Solargraph gem is installed and working.');