Initial Commit.
This commit is contained in:
commit
43e9618a72
|
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
.vscode-test/
|
||||||
|
.vsix
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"printWidth": 80,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"bracketSpacing": true
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the extensions.json format
|
||||||
|
"recommendations": [
|
||||||
|
"dbaeumer.vscode-eslint"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// A launch configuration that launches the extension inside a new window
|
||||||
|
{
|
||||||
|
"version": "0.1.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Extension",
|
||||||
|
"type": "extensionHost",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "${execPath}",
|
||||||
|
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
|
||||||
|
"stopOnEntry": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Extension Tests",
|
||||||
|
"type": "extensionHost",
|
||||||
|
"request": "launch",
|
||||||
|
"runtimeExecutable": "${execPath}",
|
||||||
|
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/test" ],
|
||||||
|
"stopOnEntry": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place your settings in this file to overwrite default and user settings.
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
.vscode/**
|
||||||
|
.vscode-test/**
|
||||||
|
test/**
|
||||||
|
.gitignore
|
||||||
|
jsconfig.json
|
||||||
|
vsc-extension-quickstart.md
|
||||||
|
.eslintrc.json
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 0.0.3
|
||||||
|
|
||||||
|
* Initial release
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright 2018 David Sergio Díaz
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Beau
|
||||||
|
|
||||||
|
This is a plugin for Beau, the awesome API testing tool.
|
||||||
|
|
||||||
|
Once loaded you can use it from the command palette. It'll read your current file and provide you with requests to execute.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Open the command palette and type `beau`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
|
||||||
|
None. For now.
|
||||||
|
|
||||||
|
## Release Notes
|
||||||
|
|
||||||
|
### Initial Release
|
||||||
|
|
||||||
|
Testing VS Code as a platform.
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
const vscode = require('vscode');
|
||||||
|
const BeauPanel = require('./src/beauPanel.js');
|
||||||
|
|
||||||
|
function activate(context) {
|
||||||
|
let beauPanel = new BeauPanel();
|
||||||
|
|
||||||
|
let disposable = vscode.commands.registerCommand(
|
||||||
|
'beau.newRequest',
|
||||||
|
function() {
|
||||||
|
beauPanel.show();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
context.subscriptions.push(disposable);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.activate = activate;
|
||||||
|
|
||||||
|
function deactivate() {}
|
||||||
|
exports.deactivate = deactivate;
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 499 KiB |
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es6",
|
||||||
|
"lib": [
|
||||||
|
"es6"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"name": "vscode-beau",
|
||||||
|
"displayName": "Beaujs",
|
||||||
|
"description": "A VS Code extension for Beau.",
|
||||||
|
"version": "0.0.4",
|
||||||
|
"publisher": "seich",
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.19.0"
|
||||||
|
},
|
||||||
|
"repository": "https://github.com/Seich/vscode-beau",
|
||||||
|
"categories": ["Other"],
|
||||||
|
"activationEvents": ["onCommand:beau.newRequest"],
|
||||||
|
"main": "./extension",
|
||||||
|
"contributes": {
|
||||||
|
"commands": [
|
||||||
|
{
|
||||||
|
"command": "beau.newRequest",
|
||||||
|
"title": "Beau: Request"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||||
|
"test": "node ./node_modules/vscode/bin/test"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^2.6.1",
|
||||||
|
"vscode": "^1.1.6",
|
||||||
|
"@types/node": "^7.0.43"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"beau": "^0.6.1",
|
||||||
|
"http-status": "^1.0.1",
|
||||||
|
"js-yaml": "^3.10.0"
|
||||||
|
},
|
||||||
|
"galleryBanner": {
|
||||||
|
"color": "#e94a58"
|
||||||
|
},
|
||||||
|
"icon": "icon.png"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
const Beau = require('beau');
|
||||||
|
const yaml = require('js-yaml');
|
||||||
|
const vscode = require('vscode');
|
||||||
|
const HTTP = require('http-status');
|
||||||
|
const { window, ProgressLocation } = vscode;
|
||||||
|
|
||||||
|
class BeauPanel {
|
||||||
|
show() {
|
||||||
|
let editor = window.activeTextEditor;
|
||||||
|
|
||||||
|
if (!editor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = editor.document.getText();
|
||||||
|
let doc = yaml.safeLoad(text);
|
||||||
|
let beau = new Beau(doc);
|
||||||
|
|
||||||
|
let aliases = beau.requests.list.map(r => ({
|
||||||
|
label: r.ALIAS,
|
||||||
|
description: r.ENDPOINT,
|
||||||
|
verb: r.VERB
|
||||||
|
}));
|
||||||
|
|
||||||
|
window.showQuickPick(aliases).then(request => {
|
||||||
|
let alias = request.label;
|
||||||
|
let task = () => beau.requests.execByAlias(alias);
|
||||||
|
|
||||||
|
window
|
||||||
|
.withProgress(
|
||||||
|
{
|
||||||
|
title: `Requesting: ${alias}`,
|
||||||
|
location: ProgressLocation.Window
|
||||||
|
},
|
||||||
|
task
|
||||||
|
)
|
||||||
|
.then(response => {
|
||||||
|
let channel = window.createOutputChannel('test');
|
||||||
|
|
||||||
|
channel.appendLine(`${request.verb} ${response.request.endpoint}`);
|
||||||
|
channel.appendLine(
|
||||||
|
`${response.response.status} ${HTTP[response.response.status]}`
|
||||||
|
);
|
||||||
|
|
||||||
|
channel.appendLine('');
|
||||||
|
channel.appendLine(`Response Headers: `);
|
||||||
|
channel.appendLine(
|
||||||
|
JSON.stringify(response.response.headers, null, 4)
|
||||||
|
);
|
||||||
|
|
||||||
|
channel.appendLine('');
|
||||||
|
channel.appendLine(`Response Body: `);
|
||||||
|
channel.appendLine(JSON.stringify(response.body, null, 4));
|
||||||
|
|
||||||
|
channel.show();
|
||||||
|
})
|
||||||
|
.catch(e => console.error(e));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = BeauPanel;
|
||||||
Loading…
Reference in New Issue