-
Notifications
You must be signed in to change notification settings - Fork 15
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 dece59b
Showing
18 changed files
with
642 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,6 @@ | ||
out | ||
node_modules | ||
.vscode-test/ | ||
*.vsix | ||
|
||
.DS_Store |
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,7 @@ | ||
{ | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": [ | ||
"eg2.tslint" | ||
] | ||
} |
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,36 @@ | ||
// A launch configuration that compiles the extension and then opens it inside a new window | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/out/**/*.js" | ||
], | ||
"preLaunchTask": "npm: watch" | ||
}, | ||
{ | ||
"name": "Extension Tests", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--extensionTestsPath=${workspaceFolder}/out/test" | ||
], | ||
"outFiles": [ | ||
"${workspaceFolder}/out/test/**/*.js" | ||
], | ||
"preLaunchTask": "npm: 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 @@ | ||
// 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 | ||
} | ||
} |
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,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 | ||
} | ||
} | ||
] | ||
} |
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/** | ||
.vscode-test/** | ||
out/test/** | ||
out/**/*.map | ||
src/** | ||
.gitignore | ||
tsconfig.json | ||
vsc-extension-quickstart.md | ||
tslint.json |
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 @@ | ||
# Change Log | ||
|
||
All notable changes to the "vscode-text-tables" 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 |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Roman Peshkov | ||
|
||
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. |
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,11 @@ | ||
# Text Tables | ||
|
||
VSCode extension that brings the power of Emacs table editing. | ||
|
||
Work in progress. Not in marketplace. There's not so much to see yet. | ||
|
||
## [License](LICENSE) | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 Roman Peshkov |
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,55 @@ | ||
{ | ||
"name": "vscode-text-tables", | ||
"displayName": "Text Tables", | ||
"description": "Work with text tables without pain", | ||
"version": "0.0.1", | ||
"publisher": "RomanPeshkov", | ||
"engines": { | ||
"vscode": "^1.21.0" | ||
}, | ||
"categories": [ | ||
"Other" | ||
], | ||
"activationEvents": [ | ||
"onCommand:text-tables.formatUnderCursor" | ||
], | ||
"main": "./out/extension", | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "text-tables.formatUnderCursor", | ||
"title": "Text Tables: Format under cursor" | ||
} | ||
], | ||
"configuration": { | ||
"type": "object", | ||
"title": "Text Tables configuration", | ||
"properties": { | ||
"text-tables.mode": { | ||
"type": "string", | ||
"enum": [ | ||
"markdown", | ||
"org" | ||
], | ||
"default": "markdown", | ||
"description": "Sets the mode in which extension should work", | ||
"scope": "window" | ||
} | ||
} | ||
} | ||
}, | ||
"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.6.1", | ||
"vscode": "^1.1.6", | ||
"tslint": "^5.8.0", | ||
"@types/node": "^7.0.43", | ||
"@types/mocha": "^2.2.42" | ||
} | ||
} |
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,52 @@ | ||
'use strict'; | ||
|
||
import * as vscode from 'vscode'; | ||
import { OrgLocator, OrgParser, OrgStringifier } from './ttOrg'; | ||
import { Locator, Parser, Stringifier } from './ttTable'; | ||
import { MarkdownLocator, MarkdownParser, MarkdownStringifier } from './ttMarkdown'; | ||
|
||
export function activate(ctx: vscode.ExtensionContext) { | ||
ctx.subscriptions.push(vscode.commands.registerCommand('text-tables.formatUnderCursor', () => { | ||
const config = vscode.workspace.getConfiguration('text-tables'); | ||
const mode = config.get<string>('mode', ''); | ||
|
||
let locator: Locator; | ||
let parser: Parser; | ||
let stringifier: Stringifier; | ||
|
||
if (mode === 'org') { | ||
locator = new OrgLocator(); | ||
parser = new OrgParser(); | ||
stringifier = new OrgStringifier(); | ||
} else { | ||
locator = new MarkdownLocator(); | ||
parser = new MarkdownParser(); | ||
stringifier = new MarkdownStringifier(); | ||
} | ||
|
||
|
||
if (vscode.window.activeTextEditor !== undefined) { | ||
const editor = vscode.window.activeTextEditor; | ||
|
||
const selectedRange = locator.locate(editor.document, editor.selection.start.line); | ||
if (selectedRange !== undefined) { | ||
const selectedText = editor.document.getText(selectedRange); | ||
|
||
const table = parser.parse(selectedText); | ||
if (table !== undefined) { | ||
const newText = stringifier.stringify(table); | ||
|
||
editor.edit(b => { | ||
b.replace(selectedRange, newText); | ||
}); | ||
} | ||
|
||
} | ||
} | ||
|
||
//vscode.window.showInformationMessage(mode); | ||
})); | ||
} | ||
|
||
export function deactivate() { | ||
} |
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 '../extension'; | ||
|
||
// Defines a Mocha test suite to group tests of similar kind together | ||
suite("Extension Tests", function () { | ||
|
||
// Defines a Mocha unit test | ||
test("Something 1", function() { | ||
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. | ||
|
||
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; |
Oops, something went wrong.