Compare commits

..

No commits in common. "master" and "v1.5.3" have entirely different histories.

26 changed files with 1151 additions and 11445 deletions

View File

@ -1,3 +1,4 @@
<!--
THERE IS A 99% CHANCE YOU ARE FILING THIS ISSUE IN THE WRONG REPOSITORY.

4
.gitignore vendored
View File

@ -1,4 +1,6 @@
node_modules/
out/
node_modules/
vendor/
typings/
.DS_Store
package-lock.json

1
.npmrc Normal file
View File

@ -0,0 +1 @@
package-lock=false

View File

@ -1,4 +0,0 @@
package.json
package-lock.json
vendor/
out/

View File

@ -1,22 +0,0 @@
{
"tabWidth": 4,
"printWidth": 120,
"proseWrap": "preserve",
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"overrides": [
{
"files": "{*.js?(on),*.y?(a)ml,.*.js?(on),.*.y?(a)ml,*.md,.prettierrc,.stylelintrc,.babelrc}",
"options": {
"tabWidth": 2
}
},
{
"files": "composer.{json,lock}",
"options": {
"tabWidth": 4
}
}
]
}

View File

@ -1,7 +1,11 @@
language: php
php:
- '7.1'
- '7.0'
env:
global:
- BUILD_LEADER_ID=1
cache:
directories:
@ -9,34 +13,22 @@ cache:
- $HOME/.composer/cache
before_install:
- nvm install '12.4.0'
- nvm use '12.4.0'
- git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch --tags
- nvm install 8
- nvm use 8
install:
- npm ci
- npm install
- composer install --prefer-dist
script:
- npm run lint
- npm run build
jobs:
include:
- stage: test
- stage: release
php: '7.1'
install:
- npm ci
- composer install --prefer-dist --no-interaction --optimize-autoloader
script:
- npm run build
- npm run semantic-release
stages:
- test
- name: release
if: branch = master AND type = push AND fork = false
after_success:
- npm run semantic-release
branches:
only:
- master
- /^renovate\/.+/
except:
- /^v\d+\.\d+\.\d+$/

9
.vscode/launch.json vendored
View File

@ -7,7 +7,9 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out"
@ -17,7 +19,10 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test"],
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out/test"

16
.vscode/settings.json vendored
View File

@ -1,10 +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
}
"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
}

8
.vscode/tasks.json vendored
View File

@ -6,12 +6,16 @@
{
"type": "npm",
"script": "build",
"problemMatcher": ["$tsc"]
"problemMatcher": [
"$tsc"
]
},
{
"type": "npm",
"script": "watch",
"problemMatcher": ["$tsc-watch"]
"problemMatcher": [
"$tsc-watch"
]
}
]
}

View File

@ -1,23 +1,9 @@
.github/**
.vscode/**
images/**
!images/logo.png
typings/**
out/test/**
test/**
src/**
vendor/jetbrains/phpstorm-stubs/**
!vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php
vendor/bin/**
**/.DS_Store
**/.editorconfig
**/.gitignore
**/.npmrc
**/.styleci.yml
**/.travis.yml
**/*.d.ts
**/*.map
**/appveyor.yml
**/dependencies.yml
**/jshintrc
**/phpunit.xml.dist
**/tsconfig.json
**/tslint.json
.gitignore
tsconfig.json
tslint.json

View File

@ -1 +0,0 @@
# See [GitHub releases](https://github.com/felixfbecker/vscode-php-intellisense/releases)

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2018 Felix Becker
Copyright (c) 2017 Felix Becker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,77 +1,59 @@
# PHP IntelliSense
[![vs marketplace](https://img.shields.io/vscode-marketplace/v/felixfbecker.php-intellisense.svg?label=vs%20marketplace)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense) [![downloads](https://img.shields.io/vscode-marketplace/d/felixfbecker.php-intellisense.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense) [![rating](https://img.shields.io/vscode-marketplace/r/felixfbecker.php-intellisense.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense) [![build](https://travis-ci.org/felixfbecker/vscode-php-intellisense.svg?branch=master)](https://travis-ci.org/felixfbecker/vscode-php-intellisense) [![php: >=7.0.0](https://img.shields.io/badge/php->=7.0-8892BF.svg)](https://php.net/) [![chat: on gitter](https://badges.gitter.im/felixfbecker/vscode-php-intellisense.svg)](https://gitter.im/felixfbecker/vscode-php-intellisense?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Latest Release](https://vsmarketplacebadge.apphb.com/version-short/felixfbecker.php-intellisense.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense) [![Installs](https://vsmarketplacebadge.apphb.com/installs/felixfbecker.php-intellisense.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense) [![Rating](https://vsmarketplacebadge.apphb.com/rating-short/felixfbecker.php-intellisense.svg)](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense) [![Build Status](https://travis-ci.org/felixfbecker/vscode-php-intellisense.svg?branch=master)](https://travis-ci.org/felixfbecker/vscode-php-intellisense) [![Dependency Status](https://gemnasium.com/felixfbecker/vscode-php-intellisense.svg)](https://gemnasium.com/felixfbecker/vscode-php-intellisense) [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg)](https://php.net/) [![Gitter](https://badges.gitter.im/felixfbecker/vscode-php-intellisense.svg)](https://gitter.im/felixfbecker/vscode-php-intellisense?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
Advanced PHP IntelliSense for Visual Studio Code.
**Note: This is just the VS Code extension that spawns the actual language server. The language server itself is implemented purely in PHP [in its own repository](https://github.com/felixfbecker/php-language-server), all features need to be implemented there and all issues should be reported there. You do NOT need to install it manually though, it is bundled in this extension.**
**Note: This is just the VS Code extension that spawns the actual language server. The language server itself is implemented purely in PHP [in its own repository](https://github.com/felixfbecker/php-language-server), all features need to be implemented there and all issues should be reported there.**
## Installation
You need at least PHP 7 installed for the extension to work. You can either add it to your PATH or set the `php.executablePath` setting.
You need at least PHP 7 installed for the extension to work. You can either add it to your PATH or set the `php.executablePath` setting.
I recommend to disable VS Code's built-in PHP IntelliSense by setting `php.suggest.basic` to `false` to avoid duplicate suggestions.
## Features
### Completion
![Completion search demo](images/completion.gif)
### Signature Help
![Signature help demo](images/signatureHelp.gif)
### Workspace symbol search
![Workspace symbol search demo](images/workspaceSymbol.gif)
### Find all References
![Find References demo](images/references.png)
### Go to Definition
![Go To Definition demo](images/definition.gif)
### Hover
![Hover class demo](images/hoverClass.png)
![Hover parameter demo](images/hoverParam.png)
### Find all symbols
![Find all symbols demo](images/documentSymbol.gif)
### Column-accurate error reporting
### Format code
![Format code demo](images/formatDocument.gif)
### Column-accurate error reporting
![Error reporting demo](images/publishDiagnostics.png)
### Code style linting
Please use a dedicated extension like [PHP CodeSniffer](https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs).
### Format code
Please use a dedicated extension like [PHP CS Fixer](https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer).
## Todo
- Rename
- Signature help
- Rename
- Signature help
## Contributing
Clone whole repository and in root directory execute:
```bash
composer install
composer install
npm install
npm run build
npm run compile
code .
```
The last command will open the folder in VS Code. Hit `F5` to launch an Extension Development Host with the extension.
For working on the language server, the easiest way is to replace the language server installation from composer in `vendor/felixfbecker/language-server` with a symlink to your local clone.

View File

@ -1,13 +1,8 @@
{
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"platform": {
"php": "7.1.0"
}
},
"require": {
"felixfbecker/language-server": "5.4.6"
"felixfbecker/language-server": "^4.6.2"
},
"scripts": {
"parse-stubs": "LanguageServer\\ComposerScripts::parseStubs",

1150
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,32 @@
collectors:
- type: js-npm
path: /
actors:
# pull requests for new major versions
- type: js-npm
path: /
actors:
# pull requests for new major versions
- type: js-npm
versions: 'Y.0.0'
settings:
# these updates should generally not have an effect on users
commit_message_prefix: 'chore: '
versions: "Y.0.0"
# receive pull requests to update composer.lock for any update to the language server or dependencies of it
# after merging, depending on whether it was a patch or feature update,
# semantic-release will bundle a new patch or feature version of the extension
- type: php-composer
path: /
# receive pull requests to update composer.lock for any update to the language server or dependencies of it
# after merging, depending on whether it was a patch or feature update,
# semantic-release will bundle a new patch or feature version of the extension
- type: php-composer:0.6.0-beta
path: /
settings:
collect_transitive: true
actors:
- type: php-composer:0.6.0-beta
versions: "L.L.Y"
settings:
collect_transitive: true
actors:
- type: php-composer
versions: 'L.L.Y'
settings:
commit_message_prefix: 'fix: '
commit_message_prefix: "fix: "
- type: php-composer
versions: 'L.Y.0'
settings:
commit_message_prefix: 'feat: '
- type: php-composer:0.6.0-beta
versions: "L.Y.0"
settings:
commit_message_prefix: "feat: "
- type: php-composer
versions: 'Y.0.0'
settings:
commit_message_prefix: 'chore: '
- type: php-composer:0.6.0-beta
versions: "Y.0.0"
settings:
commit_message_prefix: "chore: "

BIN
images/formatDocument.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

10803
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,9 +7,9 @@
"license": "MIT",
"private": true,
"preview": false,
"version": "1.5.4",
"version": "0.0.0-development",
"engines": {
"vscode": "^1.26.1"
"vscode": "^1.17.1"
},
"keywords": [
"php",
@ -19,7 +19,7 @@
"refactor"
],
"categories": [
"Programming Languages"
"Languages"
],
"icon": "images/logo.png",
"galleryBanner": {
@ -38,64 +38,41 @@
"workspaceContains:**/*.php"
],
"main": "./out/extension",
"husky": {
"hooks": {
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
},
"scripts": {
"build": "tsc -p .",
"watch": "tsc -w -p .",
"postinstall": "node ./node_modules/vscode/bin/install",
"lint": "npm run prettier && npm run tslint",
"tslint": "tslint -p tsconfig.json -c tslint.json \"src/**/*.ts\"",
"prettier": "prettier '**/{*.{js?(on),ts,yml},.*.js?(on),.*.yml,.prettierrc,*.md}' --write --list-different",
"semantic-release": "semantic-release"
"lint": "tslint -c tslint.json \"src/**/*.ts\"",
"semantic-release": "semantic-release pre && vsce publish -p $VSCE_TOKEN && semantic-release post",
"commitmsg": "validate-commit-msg"
},
"devDependencies": {
"@commitlint/cli": "7.2.1",
"@commitlint/config-conventional": "7.1.2",
"@types/execa": "0.9.0",
"@types/mocha": "5.2.7",
"@types/mz": "0.0.32",
"@types/node": "8.10.29",
"@types/semver": "6.2.0",
"husky": "1.1.3",
"prettier": "1.15.3",
"semantic-release": "15.10.8",
"semantic-release-vsce": "2.1.2",
"tslint": "5.11.0",
"tslint-config-prettier": "1.15.0",
"typescript": "3.1.6",
"vscode": "1.1.21"
"@types/mocha": "^2.2.42",
"@types/mz": "^0.0.31",
"@types/node": "^8.0.24",
"@types/semver": "^5.3.34",
"cz-conventional-changelog": "^2.0.0",
"husky": "^0.14.3",
"last-release-git": "0.0.3",
"semantic-release": "^8.2.0",
"tslint": "^5.0.0",
"typescript": "^2.1.4",
"validate-commit-msg": "^2.14.0",
"vsce": "^1.8.1",
"vscode": "^1.0.0"
},
"dependencies": {
"execa": "1.0.0",
"mz": "2.7.0",
"semver": "6.3.0",
"vscode-languageclient": "5.1.1"
"mz": "^2.4.0",
"semver": "^5.3.0",
"vscode-languageclient": "^3.0.3"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"release": {
"verifyConditions": [
"semantic-release-vsce",
"@semantic-release/github"
],
"prepare": {
"path": "semantic-release-vsce",
"packageVsix": "php-intellisense.vsix"
},
"publish": [
"semantic-release-vsce",
{
"path": "@semantic-release/github",
"assets": "php-intellisense.vsix"
}
]
"getLastRelease": "last-release-git"
},
"contributes": {
"configuration": {
@ -104,8 +81,8 @@
"properties": {
"php.memoryLimit": {
"type": "string",
"default": "4095M",
"description": "The memory limit of the php language server. [Number][K|M|G]. Use '-1' to allow unlimited use of the RAM (default is 4G).",
"default": "-1",
"description": "The memory limit of the php language server. [Number][K|M|G]. Use '-1' to allow unlimited use of the RAM(default).",
"pattern": "^\\d+[KMG]?$"
},
"php.executablePath": {

View File

@ -1,41 +0,0 @@
{
"extends": ["config:base", ":maintainLockFilesMonthly"],
"prCreation": "not-pending",
"rangeStrategy": "pin",
"semanticCommits": true,
"npm": {
"packageRules": [
{
"packagePatterns": ["*"],
"semanticCommitType": "chore",
"minor": {
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch"
}
}
]
},
"separateMinorPatch": true,
"composer": {
"enabled": true,
"rollbackPrs": false
},
"packageRules": [
{
"packagePatterns": ["^@types/"],
"automerge": true
},
{
"packageNames": ["felixfbecker/language-server"],
"schedule": [],
"updateTypes": ["minor"],
"semanticCommitType": "feat"
},
{
"packageNames": ["felixfbecker/language-server"],
"schedule": [],
"updateTypes": ["patch"],
"semanticCommitType": "fix"
}
]
}

View File

@ -1,137 +1,123 @@
import execa from 'execa'
import { ChildProcess, spawn } from 'mz/child_process'
import * as net from 'net'
import * as path from 'path'
import * as semver from 'semver'
import * as url from 'url'
import * as vscode from 'vscode'
import { LanguageClient, LanguageClientOptions, RevealOutputChannelOn, StreamInfo } from 'vscode-languageclient'
const composerJson = require('../composer.json')
import * as path from 'path';
import { spawn, execFile, ChildProcess } from 'mz/child_process';
import * as vscode from 'vscode';
import { LanguageClient, LanguageClientOptions, StreamInfo } from 'vscode-languageclient';
import * as semver from 'semver';
import * as net from 'net';
import * as url from 'url';
export async function activate(context: vscode.ExtensionContext): Promise<void> {
const conf = vscode.workspace.getConfiguration('php')
const executablePath =
conf.get<string>('executablePath') ||
conf.get<string>('validate.executablePath') ||
(process.platform === 'win32' ? 'php.exe' : 'php')
const memoryLimit = conf.get<string>('memoryLimit') || '4095M'
const conf = vscode.workspace.getConfiguration('php');
const executablePath = conf.get<string>('executablePath') || 'php';
const memoryLimit = conf.get<string>('memoryLimit') || '-1';
if (memoryLimit !== '-1' && !/^\d+[KMG]?$/.exec(memoryLimit)) {
const selected = await vscode.window.showErrorMessage(
'The memory limit you\'d provided is not numeric, nor "-1" nor valid php shorthand notation!',
'Open settings'
)
);
if (selected === 'Open settings') {
await vscode.commands.executeCommand('workbench.action.openGlobalSettings')
await vscode.commands.executeCommand('workbench.action.openGlobalSettings');
}
return
return;
}
// Check path (if PHP is available and version is ^7.0.0)
let stdout: string
let stdout: string;
try {
stdout = await execa.stdout(executablePath, ['--version'])
[stdout] = await execFile(executablePath, ['--version']);
} catch (err) {
if (err.code === 'ENOENT') {
const selected = await vscode.window.showErrorMessage(
'PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting',
'Open settings'
)
);
if (selected === 'Open settings') {
await vscode.commands.executeCommand('workbench.action.openGlobalSettings')
await vscode.commands.executeCommand('workbench.action.openGlobalSettings');
}
} else {
vscode.window.showErrorMessage('Error spawning PHP: ' + err.message)
console.error(err)
vscode.window.showErrorMessage('Error spawning PHP: ' + err.message);
console.error(err);
}
return
return;
}
// Parse version and discard OS info like 7.0.8--0ubuntu0.16.04.2
const match = stdout.match(/^PHP ([^\s]+)/m)
const match = stdout.match(/^PHP ([^\s]+)/m);
if (!match) {
vscode.window.showErrorMessage('Error parsing PHP version. Please check the output of php --version')
return
vscode.window.showErrorMessage('Error parsing PHP version. Please check the output of php --version');
return;
}
let version = match[1].split('-')[0]
let version = match[1].split('-')[0];
// Convert PHP prerelease format like 7.0.0rc1 to 7.0.0-rc1
if (!/^\d+.\d+.\d+$/.test(version)) {
version = version.replace(/(\d+.\d+.\d+)/, '$1-')
version = version.replace(/(\d+.\d+.\d+)/, '$1-');
}
if (semver.lt(version, composerJson.config.platform.php)) {
vscode.window.showErrorMessage('The language server needs at least PHP 7.1 installed. Version found: ' + version)
return
if (semver.lt(version, '7.0.0')) {
vscode.window.showErrorMessage('The language server needs at least PHP 7 installed. Version found: ' + version);
return;
}
let client: LanguageClient
const serverOptions = () =>
new Promise<ChildProcess | StreamInfo>((resolve, reject) => {
// Use a TCP socket because of problems with blocking STDIO
const serverOptions = () => new Promise<ChildProcess | StreamInfo>((resolve, reject) => {
function spawnServer(...args: string[]): ChildProcess {
// The server is implemented in PHP
args.unshift(context.asAbsolutePath(path.join('vendor', 'felixfbecker', 'language-server', 'bin', 'php-language-server.php')));
args.push('--memory-limit=' + memoryLimit);
const childProcess = spawn(executablePath, args);
childProcess.stderr.on('data', (chunk: Buffer) => {
console.error(chunk + '');
});
childProcess.stdout.on('data', (chunk: Buffer) => {
console.log(chunk + '');
});
return childProcess;
}
if (process.platform === 'win32') {
// Use a TCP socket on Windows because of blocking STDIO
const server = net.createServer(socket => {
// 'connection' listener
console.log('PHP process connected')
console.log('PHP process connected');
socket.on('end', () => {
console.log('PHP process disconnected')
})
server.close()
resolve({ reader: socket, writer: socket })
})
console.log('PHP process disconnected');
});
server.close();
resolve({ reader: socket, writer: socket });
});
// Listen on random port
server.listen(0, '127.0.0.1', () => {
// The server is implemented in PHP
const childProcess = spawn(executablePath, [
context.asAbsolutePath(
path.join('vendor', 'felixfbecker', 'language-server', 'bin', 'php-language-server.php')
),
'--tcp=127.0.0.1:' + server.address().port,
'--memory-limit=' + memoryLimit,
])
childProcess.stderr.on('data', (chunk: Buffer) => {
const str = chunk.toString()
console.log('PHP Language Server:', str)
client.outputChannel.appendLine(str)
})
// childProcess.stdout.on('data', (chunk: Buffer) => {
// console.log('PHP Language Server:', chunk + '');
// });
childProcess.on('exit', (code, signal) => {
client.outputChannel.appendLine(
`Language server exited ` + (signal ? `from signal ${signal}` : `with exit code ${code}`)
)
if (code !== 0) {
client.outputChannel.show()
}
})
return childProcess
})
})
spawnServer('--tcp=127.0.0.1:' + server.address().port);
});
} else {
// Use STDIO on Linux / Mac
resolve(spawnServer());
}
});
// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for php documents
documentSelector: [{ scheme: 'file', language: 'php' }, { scheme: 'untitled', language: 'php' }],
revealOutputChannelOn: RevealOutputChannelOn.Never,
documentSelector: ['php'],
uriConverters: {
// VS Code by default %-encodes even the colon after the drive letter
// NodeJS handles it much better
code2Protocol: uri => url.format(url.parse(uri.toString(true))),
protocol2Code: str => vscode.Uri.parse(str),
protocol2Code: str => vscode.Uri.parse(str)
},
synchronize: {
// Synchronize the setting section 'php' to the server
configurationSection: 'php',
// Notify the server about changes to PHP files in the workspace
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.php'),
},
}
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.php')
}
};
// Create the language client and start the client.
client = new LanguageClient('PHP Language Server', serverOptions, clientOptions)
const disposable = client.start()
const disposable = new LanguageClient('PHP Language Server', serverOptions, clientOptions).start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(disposable)
context.subscriptions.push(disposable);
}

View File

@ -4,7 +4,7 @@
//
// The module 'assert' provides assertion methods from node
import * as assert from 'assert'
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
@ -13,9 +13,10 @@ import * as assert from 'assert'
// 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))
})
})
assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0));
});
});

View File

@ -10,13 +10,13 @@
// 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')
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.ts (suite, test, etc.)
useColors: true, // colored output from test results
})
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
module.exports = testRunner;

View File

@ -1,13 +1,14 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "out",
"esModuleInterop": true,
"lib": ["es6"],
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "out",
"lib": [
"es6"
],
"noImplicitAny": true,
"sourceMap": true,
"sourceMap": true,
"rootDir": "src",
"strictNullChecks": true,
"noImplicitThis": true,
@ -15,6 +16,9 @@
"noUnusedLocals": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false
},
"exclude": ["node_modules", "out", "vendor"]
},
"exclude": [
"node_modules",
"out"
]
}

View File

@ -1,85 +1,43 @@
{
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": {
"adjacent-overload-signatures": true,
"array-type": [true, "array"],
"arrow-return-shorthand": [true, "multiline"],
"await-promise": [true, "Thenable"],
"ban": [
true,
{
"name": ["*", "forEach"]
},
["describe", "only"],
["it", "only"]
],
"callable-types": true,
"class-name": true,
"comment-format": [true, "check-space"],
"curly": true,
"deprecation": {
"severity": "warning"
},
"interface-name": [false],
"interface-over-type-literal": true,
"jsdoc-format": true,
"max-classes-per-file": false,
"member-access": [true, "check-accessor"],
"member-ordering": [false],
"no-angle-bracket-type-assertion": true,
"no-arg": true,
"no-bitwise": false,
"no-boolean-literal-compare": true,
"no-conditional-assignment": true,
"no-console": [false],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-empty-interface": false,
"indent": [true, "spaces"],
"no-eval": true,
"no-floating-promises": [true],
"no-for-in-array": true,
"no-inferrable-types": [true],
"no-inferred-empty-object-type": true,
"no-internal-module": true,
"no-invalid-template-strings": true,
"no-magic-numbers": false,
"no-misused-new": true,
"no-namespace": [false, "allow-declarations"],
"no-reference-import": true,
"no-shadowed-variable": false,
"no-sparse-arrays": true,
"no-string-literal": true,
"no-string-throw": true,
"no-unbound-method": true,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-qualifier": true,
"no-unnecessary-type-assertion": false,
"no-unsafe-any": false,
"no-unsafe-finally": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-trailing-whitespace": true,
"no-var-keyword": true,
"no-var-requires": false,
"no-void-expression": false,
"object-literal-shorthand": true,
"object-literal-sort-keys": false,
"one-variable-per-declaration": [true, "ignore-for-loop"],
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": [
"one-line": [true, "check-catch", "check-finally", "check-else", "check-open-brace", "check-whitespace"],
"quotemark": [true, "single"],
"semicolon": [true, "always"],
"triple-equals": [true, "allow-null-check"],
"typedef-whitespace": [
true,
{
"destructuring": "all"
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
],
"prefer-for-of": true,
"prefer-template": [false, "allow-single-concat"],
"return-undefined": true,
"triple-equals": [true],
"typedef": [true, "call-signature"],
"unified-signatures": true,
"variable-name": [true, "ban-keywords"]
"variable-name": [true, "ban-keywords"],
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"],
"jsdoc-format": true,
"no-consecutive-blank-lines": true,
"one-variable-per-declaration": [true, "ignore-for-loop"],
"curly": true,
"no-empty": true,
"no-unused-expression": true,
"eofline": true,
"trailing-comma": [true, {"singleline": "never", "multiline": "never"}],
"align": [true, "parameters", "statements"]
}
}