Skip to content

Commit

Permalink
add options for completion and signatureHelp
Browse files Browse the repository at this point in the history
  • Loading branch information
doublefint committed Jun 1, 2018
1 parent 729af86 commit 1c9198a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to the "vscode-pgsql" extension will be documented in this f

## [Unreleased]

## 0.1.1
### Added
- option to enable/disable code completion, reload required
- option to enable/disable signature help, reload required

## 0.1.0
### Changed
- Signature loaded from Postgres 9.5
Expand Down
18 changes: 13 additions & 5 deletions extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ exports.activate = context => {
let disposable = vscode.commands.registerCommand( 'pgsql.run', cmd.run )
context.subscriptions.push( disposable )

const doctype = 'pgsql'
disposable = vscode.languages.registerCompletionItemProvider( doctype, completion, " " )
context.subscriptions.push( disposable )
const scheme = 'file', language = 'pgsql' // see https://go.microsoft.com/fwlink/?linkid=872305
const completionConfig = vscode.workspace.getConfiguration( "pgsql.completion" )

if ( completionConfig.get( 'enabled' ) ) {
disposable = vscode.languages.registerCompletionItemProvider( { scheme, language }, completion, "" )
context.subscriptions.push( disposable )
}

const signatureHelpConfig = vscode.workspace.getConfiguration( "pgsql.signatureHelp" )
if ( signatureHelpConfig.get( 'enabled' ) ) {
disposable = vscode.languages.registerSignatureHelpProvider( { scheme, language }, signature, '(', ',' )
context.subscriptions.push( disposable )
}

disposable = vscode.languages.registerSignatureHelpProvider( doctype, signature, '(', ',' )
context.subscriptions.push( disposable )

}

Expand Down
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "pgsql",
"description": "run sql in your postgres instance",
"license": "MIT",
"version": "0.1.0",
"version": "0.1.1",
"publisher": "doublefint",
"engines": {
"vscode": "^1.19.0"
Expand Down Expand Up @@ -66,7 +66,18 @@
"type": "string",
"default": "postgres://username:pasword@localhost:5432/dbname",
"description": "connection string to your postgres db"
},
"pgsql.completion.enabled": {
"type": "boolean",
"default": true,
"description": "enable or disable code completion"
},
"pgsql.signatureHelp.enabled": {
"type": "boolean",
"default": true,
"description": "enable or disable code completion"
}

}
},
"snippets": [ { "language": "pgsql", "path": "./extension/snippets.json" } ]
Expand Down

0 comments on commit 1c9198a

Please sign in to comment.