OpenTK
This commit is contained in:
23
JavaScript/negative-spacing/.eslintrc.json
Normal file
23
JavaScript/negative-spacing/.eslintrc.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": false,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
"no-const-assign": "warn",
|
||||
"no-this-before-super": "warn",
|
||||
"no-undef": "warn",
|
||||
"no-unreachable": "warn",
|
||||
"no-unused-vars": "warn",
|
||||
"constructor-super": "warn",
|
||||
"valid-typeof": "warn"
|
||||
}
|
||||
}
|
||||
3
JavaScript/negative-spacing/.gitattributes
vendored
Normal file
3
JavaScript/negative-spacing/.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
* text=auto
|
||||
|
||||
3
JavaScript/negative-spacing/.gitignore
vendored
Normal file
3
JavaScript/negative-spacing/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
.vscode-test/
|
||||
*.vsix
|
||||
7
JavaScript/negative-spacing/.vscode/extensions.json
vendored
Normal file
7
JavaScript/negative-spacing/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint"
|
||||
]
|
||||
}
|
||||
28
JavaScript/negative-spacing/.vscode/launch.json
vendored
Normal file
28
JavaScript/negative-spacing/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// A launch configuration that launches the extension 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}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Extension Tests",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": [
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--extensionTestsPath=${workspaceFolder}/test"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
3
JavaScript/negative-spacing/.vscode/settings.json
vendored
Normal file
3
JavaScript/negative-spacing/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
}
|
||||
7
JavaScript/negative-spacing/.vscodeignore
Normal file
7
JavaScript/negative-spacing/.vscodeignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.vscode/**
|
||||
.vscode-test/**
|
||||
test/**
|
||||
.gitignore
|
||||
jsconfig.json
|
||||
vsc-extension-quickstart.md
|
||||
.eslintrc.json
|
||||
7
JavaScript/negative-spacing/CHANGELOG.md
Normal file
7
JavaScript/negative-spacing/CHANGELOG.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Change Log
|
||||
All notable changes to the "negative-spacing" 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
|
||||
65
JavaScript/negative-spacing/README.md
Normal file
65
JavaScript/negative-spacing/README.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# negative-spacing README
|
||||
|
||||
This is the README for your extension "negative-spacing". 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 macOS or `Ctrl+\` on Windows and Linux)
|
||||
* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
|
||||
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) 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!**
|
||||
83
JavaScript/negative-spacing/extension.js
Normal file
83
JavaScript/negative-spacing/extension.js
Normal file
@@ -0,0 +1,83 @@
|
||||
// The module 'vscode' contains the VS Code extensibility API
|
||||
// Import the module and reference it with the alias vscode in your code below
|
||||
const vscode = require('vscode');
|
||||
|
||||
// this method is called when your extension is activated
|
||||
// your extension is activated the very first time the command is executed
|
||||
function activate(context) {
|
||||
|
||||
// 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 "negative-spacing" 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.sayHello', function () {
|
||||
// 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!');
|
||||
});
|
||||
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
exports.activate = activate;
|
||||
|
||||
// this method is called when your extension is deactivated
|
||||
function deactivate() {
|
||||
}
|
||||
exports.deactivate = deactivate;
|
||||
|
||||
|
||||
function negativeIndent(text) {
|
||||
let encounteredIndent = false;
|
||||
let indentString = '';
|
||||
let lines = [];
|
||||
let indents = [];
|
||||
|
||||
for (let line of text.split('\n')) {
|
||||
if (!encounteredIndent) {
|
||||
let whitespace = /^\s*/.exec(line)[0];
|
||||
|
||||
if (whitespace.length > 0) {
|
||||
encounteredIndent = true;
|
||||
indentString = whitespace;
|
||||
} else {
|
||||
lines.push(line);
|
||||
indents.push(0);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let indentLevel = 0;
|
||||
|
||||
while (line.substring(0, indentString.length) === indentString) {
|
||||
indentLevel++;
|
||||
line = line.substring(indentString.length);
|
||||
}
|
||||
|
||||
lines.push(line);
|
||||
indents.push(indentLevel);
|
||||
}
|
||||
|
||||
if (!encounteredIndent) {
|
||||
return text;
|
||||
}
|
||||
|
||||
console.log(lines, indents);
|
||||
|
||||
let maxIndent = Math.max(...indents);
|
||||
|
||||
let newText = '';
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
let line = lines[i];
|
||||
let indentLevel = indents[i];
|
||||
|
||||
newText += indentString.repeat(maxIndent - indentLevel) + line + '\n';
|
||||
}
|
||||
|
||||
return newText;
|
||||
}
|
||||
13
JavaScript/negative-spacing/jsconfig.json
Normal file
13
JavaScript/negative-spacing/jsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"checkJs": true, /* Typecheck .js files. */
|
||||
"lib": [
|
||||
"es6"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
2926
JavaScript/negative-spacing/package-lock.json
generated
Normal file
2926
JavaScript/negative-spacing/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
36
JavaScript/negative-spacing/package.json
Normal file
36
JavaScript/negative-spacing/package.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "negative-spacing",
|
||||
"displayName": "Negative spacing",
|
||||
"description": "spacing, but negative",
|
||||
"version": "0.0.1",
|
||||
"publisher": "Ben",
|
||||
"engines": {
|
||||
"vscode": "^1.26.0"
|
||||
},
|
||||
"categories": [
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [
|
||||
"onCommand:extension.sayHello"
|
||||
],
|
||||
"main": "./extension",
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "extension.sayHello",
|
||||
"title": "Hello World"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||
"test": "node ./node_modules/vscode/bin/test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^2.6.1",
|
||||
"vscode": "^1.1.21",
|
||||
"eslint": "^4.11.0",
|
||||
"@types/node": "^8.10.25",
|
||||
"@types/mocha": "^2.2.42"
|
||||
}
|
||||
}
|
||||
24
JavaScript/negative-spacing/test/extension.test.js
Normal file
24
JavaScript/negative-spacing/test/extension.test.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/* global suite, test */
|
||||
|
||||
//
|
||||
// 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
|
||||
const assert = require('assert');
|
||||
|
||||
// You can import and use all API from the 'vscode' module
|
||||
// as well as import your extension to test it
|
||||
// const vscode = require('vscode');
|
||||
// const myExtension = require('../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));
|
||||
});
|
||||
});
|
||||
22
JavaScript/negative-spacing/test/index.js
Normal file
22
JavaScript/negative-spacing/test/index.js
Normal file
@@ -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.
|
||||
|
||||
const 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.js (suite, test, etc.)
|
||||
useColors: true // colored output from test results
|
||||
});
|
||||
|
||||
module.exports = testRunner;
|
||||
33
JavaScript/negative-spacing/vsc-extension-quickstart.md
Normal file
33
JavaScript/negative-spacing/vsc-extension-quickstart.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Welcome to your VS Code Extension
|
||||
|
||||
## What's in the folder
|
||||
* This folder contains all of the files necessary for your extension.
|
||||
* `package.json` - this is the manifest file in which you declare your extension and command.
|
||||
The sample plugin registers a command and defines its title and command name. With this information
|
||||
VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
|
||||
* `extension.js` - this is the main file where you will provide the implementation of your command.
|
||||
The file exports one function, `activate`, which is called the very first time your extension is
|
||||
activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
|
||||
We pass the function containing the implementation of the command as the second parameter to
|
||||
`registerCommand`.
|
||||
|
||||
## Get up and running straight away
|
||||
* Press `F5` to open a new window with your extension loaded.
|
||||
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
|
||||
* Set breakpoints in your code inside `extension.js` to debug your extension.
|
||||
* Find output from your extension in the debug console.
|
||||
|
||||
## Make changes
|
||||
* You can relaunch the extension from the debug toolbar after changing code in `extension.js`.
|
||||
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
|
||||
|
||||
## Explore the API
|
||||
* You can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`.
|
||||
|
||||
## Run tests
|
||||
* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`.
|
||||
* Press `F5` to run the tests in a new window with your extension loaded.
|
||||
* See the output of the test result in the debug console.
|
||||
* Make changes to `test/extension.test.js` or create new test files inside the `test` folder.
|
||||
* By convention, the test runner will only consider files matching the name pattern `**.test.js`.
|
||||
* You can create folders inside the `test` folder to structure your tests any way you want.
|
||||
Reference in New Issue
Block a user