commit
711c1faebd
@ -0,0 +1,4 @@
|
||||
out
|
||||
node_modules
|
||||
.vscode-test/
|
||||
.vsix
|
@ -0,0 +1,28 @@
|
||||
// A launch configuration that compiles the extension and then opens it inside a new window
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [ "${workspaceRoot}/out/**/*.js" ],
|
||||
"preLaunchTask": "npm: watch"
|
||||
},
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outFiles": [ "${workspaceRoot}/out/test/**/*.js" ],
|
||||
"preLaunchTask": "npm: watch"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.exclude": {
|
||||
"out": false // set this to true to hide the "out" folder with the compiled JS files
|
||||
},
|
||||
"search.exclude": {
|
||||
"out": true // set this to false to include "out" folder in search results
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
.vscode/**
|
||||
.vscode-test/**
|
||||
out/test/**
|
||||
out/**/*.map
|
||||
src/**
|
||||
.gitignore
|
||||
tsconfig.json
|
||||
vsc-extension-quickstart.md
|
@ -0,0 +1,7 @@
|
||||
# Change Log
|
||||
All notable changes to the "frog" extension will be documented in this file.
|
||||
|
||||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
|
||||
|
||||
## [Unreleased]
|
||||
- Initial release
|
@ -0,0 +1,65 @@
|
||||
# frog README
|
||||
|
||||
This is the README for your extension "frog". 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 OSX or `Ctrl+\` on Windows and Linux)
|
||||
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux)
|
||||
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) 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!**
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "frog",
|
||||
"displayName": "frog",
|
||||
"description": "The Oracle SQL workbench for VSCode",
|
||||
"version": "0.0.1",
|
||||
"publisher": "Thorsten",
|
||||
"engines": {
|
||||
"vscode": "^1.17.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onCommand:extension.executeSnippet",
|
||||
"onLanguage:plsql",
|
||||
"onView:connections"
|
||||
],
|
||||
"main": "./out/extension",
|
||||
"contributes": {
|
||||
"commands": [{
|
||||
"command": "extension.executeSnippet",
|
||||
"title": "Execute SQL Snippet"
|
||||
}],
|
||||
"keybindings": [{
|
||||
"command": "extension.executeSnippet",
|
||||
"key": "ctrl+enter",
|
||||
"mac": "ctrl+enter",
|
||||
"when": "editorHasSelection"
|
||||
}],
|
||||
"views": {
|
||||
"explorer": [
|
||||
{
|
||||
"id": "connections",
|
||||
"name": "Connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"test": "npm run compile && node ./node_modules/vscode/bin/test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^2.5.3",
|
||||
"vscode": "^1.1.5",
|
||||
"@types/node": "^7.0.43",
|
||||
"@types/mocha": "^2.2.42"
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
import { ExtensionContext, TreeDataProvider, EventEmitter, TreeItem, Event, window, TreeItemCollapsibleState, Uri, commands, workspace, TextDocumentContentProvider, CancellationToken, ProviderResult } from 'vscode';
|
||||
import * as path from 'path';
|
||||
|
||||
interface IEntry {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export class ConnectionNode {
|
||||
|
||||
constructor(private _name:string, private _uri:string) {
|
||||
}
|
||||
|
||||
public get name(): string {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public get uri(): string {
|
||||
return this._name;
|
||||
}
|
||||
}
|
||||
|
||||
export class ConnectionModel {
|
||||
|
||||
public get roots(): Thenable<ConnectionNode[]> {
|
||||
let list : ConnectionNode[] = [
|
||||
new ConnectionNode("swdev", "foobar"),
|
||||
new ConnectionNode("swint", "foobar")
|
||||
];
|
||||
|
||||
return new Promise((c, e) => c(list));
|
||||
}
|
||||
|
||||
public getChildren(node: ConnectionNode): Thenable<ConnectionNode[]> {
|
||||
return new Promise((c, e) => []);
|
||||
}
|
||||
}
|
||||
|
||||
export class ConnectionProvider implements TreeDataProvider<ConnectionNode>, TextDocumentContentProvider {
|
||||
|
||||
private _onDidChangeTreeData: EventEmitter<any> = new EventEmitter<any>();
|
||||
readonly onDidChangeTreeData: Event<any> = this._onDidChangeTreeData.event;
|
||||
|
||||
private model: ConnectionModel;
|
||||
|
||||
public getTreeItem(element: ConnectionNode): TreeItem {
|
||||
return {
|
||||
label: element.name,
|
||||
collapsibleState: void 0,
|
||||
command: {
|
||||
command: 'openConnection',
|
||||
arguments: [element.uri],
|
||||
title: 'Open Connection'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public getChildren(element?: ConnectionNode): ConnectionNode[] | Thenable<ConnectionNode[]> {
|
||||
if (!element) {
|
||||
if (!this.model) {
|
||||
this.model = new ConnectionModel();
|
||||
}
|
||||
|
||||
return this.model.roots;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public provideTextDocumentContent(uri: Uri, token: CancellationToken): ProviderResult<string> {
|
||||
return "nix";
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
'use strict';
|
||||
// The module 'vscode' contains the VS Code extensibility API
|
||||
// Import the module and reference it with the alias vscode in your code below
|
||||
import * as vscode from 'vscode';
|
||||
import { ConnectionProvider, ConnectionNode } from './connections'
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
var dbSession = null;
|
||||
|
||||
// this method is called when your extension is activated
|
||||
// your extension is activated the very first time the command is executed
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
const connectionProvider = new ConnectionProvider();
|
||||
|
||||
vscode.window.registerTreeDataProvider('connections', connectionProvider);
|
||||
|
||||
// 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 "frog" 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('extension.executeSnippet', () => {
|
||||
// The code you place here will be executed every time your command is executed
|
||||
|
||||
let editor = vscode.window.activeTextEditor;
|
||||
|
||||
if (!editor) return;
|
||||
|
||||
let selection = editor.selection;
|
||||
|
||||
if (selection.isEmpty) return;
|
||||
|
||||
let text = editor.document.getText(selection);
|
||||
|
||||
var myOutputChannel = vscode.window.createOutputChannel('SQL Query Results');
|
||||
|
||||
if (!dbSession) {
|
||||
dbSession = spawn("dbc", ['-q', 'scint']);
|
||||
|
||||
dbSession.stdout.on('data', (data) => {
|
||||
myOutputChannel.show();
|
||||
myOutputChannel.append(data.toString());
|
||||
});
|
||||
|
||||
dbSession.stderr.on('data', (data) => {
|
||||
myOutputChannel.show();
|
||||
myOutputChannel.append(data.toString());
|
||||
});
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
vscode.window.showInformationMessage('No text selected');
|
||||
return;
|
||||
}
|
||||
|
||||
myOutputChannel.append("Executing: '" + text + "'\n");
|
||||
dbSession.stdin.write(text + "\n");
|
||||
|
||||
});
|
||||
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
|
||||
// this method is called when your extension is deactivated
|
||||
export function deactivate() {
|
||||
if (dbSession) dbSession.stdin.end();
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Note: This example test is leveraging the Mocha test framework.
|
||||
// Please refer to their documentation on https://mochajs.org/ for help.
|
||||
//
|
||||
|
||||
// The module 'assert' provides assertion methods from node
|
||||
import * as assert from 'assert';
|
||||
|
||||
// You can import and use all API from the 'vscode' module
|
||||
// as well as import your extension to test it
|
||||
import * as vscode from 'vscode';
|
||||
import * as myExtension from '../extension';
|
||||
|
||||
// Defines a Mocha test suite to group tests of similar kind together
|
||||
suite("Extension Tests", () => {
|
||||
|
||||
// Defines a Mocha unit test
|
||||
test("Something 1", () => {
|
||||
assert.equal(-1, [1, 2, 3].indexOf(5));
|
||||
assert.equal(-1, [1, 2, 3].indexOf(0));
|
||||
});
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
//
|
||||
// This file is providing the test runner to use when running extension tests.
|
||||
// By default the test runner in use is Mocha based.
|
||||
//
|
||||
// You can provide your own test runner if you want to override it by exporting
|
||||
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
|
||||
// host can call to run the tests. The test runner is expected to use console.log
|
||||
// to report the results back to the caller. When the tests are finished, return
|
||||
// a possible error to the callback or null if none.
|
||||
|
||||
import * as testRunner from 'vscode/lib/testrunner';
|
||||
|
||||
// You can directly control Mocha options by uncommenting the following lines
|
||||
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
|
||||
testRunner.configure({
|
||||
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
|
||||
useColors: true // colored output from test results
|
||||
});
|
||||
|
||||
module.exports = testRunner;
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"outDir": "out",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"sourceMap": true,
|
||||
"rootDir": "src"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode-test"
|
||||
]
|
||||
}
|
Loading…
Reference in new issue