-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 60af2f6
Showing
15 changed files
with
489 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
out | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
"outDir": "out/src", | ||
"preLaunchTask": "npm" | ||
}, | ||
{ | ||
"name": "Launch Tests", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], | ||
"stopOnEntry": false, | ||
"sourceMaps": true, | ||
"outDir": "out/test", | ||
"preLaunchTask": "npm" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// 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 | ||
}, | ||
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Available variables which can be used inside of strings. | ||
// ${workspaceRoot}: the root folder of the team | ||
// ${file}: the current opened file | ||
// ${fileBasename}: the current opened file's basename | ||
// ${fileDirname}: the current opened file's dirname | ||
// ${fileExtname}: the current opened file's extension | ||
// ${cwd}: the current working directory of the spawned process | ||
|
||
// A task runner that calls a custom npm script that compiles the extension. | ||
{ | ||
"version": "0.1.0", | ||
|
||
// we want to run npm | ||
"command": "npm", | ||
|
||
// the command is a shell script | ||
"isShellCommand": true, | ||
|
||
// show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
|
||
// we run the custom script "compile" as defined in package.json | ||
"args": ["run", "compile", "--loglevel", "silent"], | ||
|
||
// The tsc compiler is started in watching mode | ||
"isWatching": true, | ||
|
||
// use the standard tsc in watch mode problem matcher to find compile problems in the output. | ||
"problemMatcher": "$tsc-watch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vscode/** | ||
typings/** | ||
out/test/** | ||
test/** | ||
src/** | ||
**/*.map | ||
.gitignore | ||
tsconfig.json | ||
vsc-extension-quickstart.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# README | ||
## This is the README for your extension "ForceCode" | ||
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!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "ForceCode", | ||
"description": "Salesforce extension", | ||
"version": "0.0.1", | ||
"publisher": "John Nelson", | ||
"engines": { | ||
"vscode": "^0.10.1" | ||
}, | ||
"categories": [ | ||
"Other" | ||
], | ||
"activationEvents": [ | ||
"onCommand:extension.sayHello" | ||
], | ||
"main": "./out/src/extension", | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "extension.sayHello", | ||
"title": "Execute Anonymous" | ||
} | ||
], | ||
"keybindings": [{ | ||
"command": "extension.sayHello", | ||
"key": "cmd+s", | ||
"when": "" | ||
}] | ||
}, | ||
"scripts": { | ||
"vscode:prepublish": "node ./node_modules/vscode/bin/compile", | ||
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^1.6.2", | ||
"vscode": "0.10.x" | ||
}, | ||
"dependencies": { | ||
"jsforce": "^1.5.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// 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 * as jsforce from 'jsforce'; | ||
import * as SOAP from 'jsforce/lib/soap'; | ||
|
||
var config: { | ||
userId: string; | ||
queryString: string; | ||
conn: {}; | ||
apexBody: string; | ||
output: vscode.OutputChannel | ||
}; | ||
|
||
// 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) { | ||
'use strict'; | ||
// 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('ForceCode 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 | ||
var disposable = vscode.commands.registerCommand('extension.sayHello', () => { | ||
// 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!'); | ||
// vscode.window.showInformationMessage(text); | ||
|
||
|
||
|
||
|
||
// Get the active window text | ||
config.apexBody = vscode.window.activeTextEditor.document.getText(); | ||
|
||
// Create the output channel that we will pipe our results to. | ||
config.output = vscode.window.createOutputChannel('ForceCode'); | ||
|
||
// Establish our connection object | ||
config.conn = new jsforce.Connection(); | ||
|
||
// Login, then get Identity info, then enable logging, then execute the query, then get the debug log, then disable logging | ||
config.conn.login('[email protected]', 'Science3').then(console.log); | ||
}); | ||
|
||
context.subscriptions.push(disposable); | ||
} | ||
// function(err, res) { | ||
// if (err) { return console.error(err); } | ||
// // config.conn.query('SELECT Id, Name FROM Account', function(err, res) { | ||
// // if (err) { return console.error(err); } | ||
// // // console.log(res); | ||
// // output.show(3); | ||
// // // res.records.forEach(element => { | ||
// // // output.appendLine(element.Name); | ||
// // // }); | ||
// // }); | ||
// config.conn.identity(function(err, res) { | ||
// if (err) { return console.error(err); } | ||
// config.userId = res.user_id; | ||
// var debugConfig = { | ||
// 'TracedEntityId': res.user_id, | ||
// 'ExpirationDate': '2016-02-06', | ||
// 'ScopeId': undefined, | ||
// 'ApexCode': 'Debug', | ||
// 'ApexProfiling': 'Error', | ||
// 'Callout': 'Error', | ||
// 'Database': 'Error', | ||
// 'Validation': 'Error', | ||
// 'Visualforce': 'Error', | ||
// 'Workflow': 'Error', | ||
// 'System': 'Error', | ||
// }; | ||
|
||
// config.conn.tooling.sobject('traceFlag').create(debugConfig, executeAnonymous); | ||
// }); | ||
|
||
// } | ||
|
||
// function executeAnonymous(err, res) { | ||
// 'use strict'; | ||
// if (err) { | ||
// return console.error(err); | ||
// } | ||
// console.log(res); | ||
|
||
// config.conn.tooling.executeAnonymous(apexBody, executeCallback); | ||
// // console.log("compiled?: " + res.compiled); // compiled successfully | ||
// // console.log("executed?: " + res.success); // executed successfully | ||
// // var soapEndpoint = new SOAP(conn, { | ||
// // xmlns: "urn:partner.soap.sforce.com", | ||
// // endpointUrl: config.conn.instanceUrl + "/services/Soap/u/" + config.conn.version | ||
// // }); | ||
// // return soapEndpoint.invoke('executeanonymous', apexBody).then(function(res) { | ||
// // return res.result; | ||
// // }).thenCall(console.log); | ||
|
||
// } | ||
|
||
// function executeCallback(err, res) { | ||
// 'use strict'; | ||
// var message: string = ''; | ||
// if (!res.compiled) { | ||
// message = 'Compile Problem: ' + res.compileProblem; | ||
// vscode.window.showErrorMessage(message); | ||
// return console.error(message); | ||
// } | ||
// if (!res.success) { | ||
// message = 'Exception: ' + res.exceptionMessage; | ||
// vscode.window.showErrorMessage(message); | ||
// return console.error(); | ||
// } | ||
// vscode.window.showInformationMessage('Success!'); | ||
// config.queryString = `SELECT Id FROM ApexLog WHERE Request = 'API' AND Operation like '%executeAnonymous%'` + | ||
// `AND LogUserId='${config.userId}' ORDER BY StartTime DESC, Id DESC LIMIT 1`; | ||
|
||
// config.conn.query(config.queryString, queryCallback); | ||
// } | ||
|
||
// function queryCallback(err, res) { | ||
// 'use strict'; | ||
// if (err) { return console.error(err); } | ||
// console.log('total : ' + res.totalSize); | ||
// console.log('fetched : ' + res.records.length); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 '../src/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)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
||
var testRunner = require('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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "ES5", | ||
"outDir": "out", | ||
"noLib": true, | ||
"sourceMap": true | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} | ||
|
||
|
Oops, something went wrong.