Compare commits

..

No commits in common. "master" and "v0.0.6" have entirely different histories.

36 changed files with 254 additions and 12239 deletions

View File

@ -1,17 +0,0 @@
<!--
THERE IS A 99% CHANCE YOU ARE FILING THIS ISSUE IN THE WRONG REPOSITORY.
This is just the repository for the thin VS Code extension.
If this issue is *not* directly related to the *integration* into VS Code,
but a bug, feature request, performance issue, crash, etc. it needs to be filed
in the repository of the *language server*:
https://github.com/felixfbecker/php-language-server
Most likely there is already an open issue, please search for one first.
Thank you.
-->

5
.gitignore vendored
View File

@ -1,4 +1,5 @@
node_modules/
out/ out/
node_modules/
vendor/ vendor/
.DS_Store composer.lock
typings/

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,42 +1,21 @@
language: php language: php
php: php:
- '7.1' - '7.0'
cache:
directories:
- $HOME/.npm
- $HOME/.composer/cache
before_install: before_install:
- nvm install '12.4.0' - nvm install 5.10.0
- nvm use '12.4.0' - nvm use 5.10.0
install: install:
- npm ci - npm install
- typings install
- composer install
script: script:
- npm run lint - npm run lint
- npm run build - npm run compile
jobs: after_success:
include: # If the build was triggered by a tag, publish the new version
- stage: test - 'if [[ $TRAVIS_TAG == v* ]]; then vsce publish -p $VSCE_TOKEN; fi'
- 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
branches:
only:
- master
- /^renovate\/.+/

9
.vscode/launch.json vendored
View File

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

38
.vscode/tasks.json vendored
View File

@ -1,17 +1,37 @@
// 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.
{ {
// See https://go.microsoft.com/fwlink/?LinkId=733558 "version": "0.1.0",
// for the documentation about the tasks.json format // we want to run npm
"version": "2.0.0", "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",
"--loglevel",
"silent"
],
"tasks": [ "tasks": [
{ {
"type": "npm", "taskName": "compile",
"script": "build", "isBuildCommand": true,
"problemMatcher": ["$tsc"] "problemMatcher": "$tsc"
}, },
{ {
"type": "npm", "taskName": "watch",
"script": "watch", // The tsc compiler is started in watching mode
"problemMatcher": ["$tsc-watch"] "isWatching": true,
// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
} }
] ]
} }

View File

@ -1,23 +1,9 @@
.github/**
.vscode/** .vscode/**
images/** typings/**
!images/logo.png
out/test/** out/test/**
test/**
src/** 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 **/*.map
**/appveyor.yml .gitignore
**/dependencies.yml tsconfig.json
**/jshintrc tslint.json
**/phpunit.xml.dist
**/tsconfig.json
**/tslint.json

View File

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

21
LICENSE
View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017-2018 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
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.

View File

@ -1,77 +1,48 @@
# PHP IntelliSense # 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) > **⚠ Work In Progress**
[![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)
Advanced PHP IntelliSense for Visual Studio Code. Advanced PHP IntelliSense for Visual Studio Code.
In opposite to the included PHP IntelliSense and other PHP extensions, this uses an AST to parse the source code
instead of relying on naive regular expression parsing.
**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.**
## Installation **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 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 and in your PATH for the extension to work.
I recommend to disable VS Code's built-in PHP IntelliSense by setting `php.suggest.basic` to `false` to avoid duplicate suggestions.
## Features ## 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
![Find all symbols demo](images/documentSymbol.gif) ![Find all symbols demo](images/documentSymbol.gif)
### Column-accurate error reporting ### Column-accurate error reporting
![Error reporting demo](images/publishDiagnostics.png) ![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 ### Format code
![Format code demo](images/formatDocument.gif)
Please use a dedicated extension like [PHP CS Fixer](https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer).
## Todo ## Todo
- Autocompletion
- Rename
- Goto definition
- Hover
- Signature help
- Follow composer autoloading
- Rename
- Signature help
## Contributing ## Contributing
Clone whole repository and in root directory execute: Clone whole repository and in root directory execute:
```bash ```bash
composer install composer install
npm install npm install
npm run build npm run compile
code . code .
``` ```
The last command will open the folder in VS Code. Hit `F5` to launch an Extension Development Host with the extension. 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. 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,17 +1,7 @@
{ {
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,
"config": {
"platform": {
"php": "7.1.0"
}
},
"require": { "require": {
"felixfbecker/language-server": "5.4.6" "felixfbecker/language-server": "^2.0"
},
"scripts": {
"parse-stubs": "LanguageServer\\ComposerScripts::parseStubs",
"post-update-cmd": "@parse-stubs",
"post-install-cmd": "@parse-stubs"
} }
} }

864
composer.lock generated
View File

@ -1,864 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "9c2828a729b23a2d11872a4acf98a8e5",
"packages": [
{
"name": "composer/xdebug-handler",
"version": "1.3.3",
"source": {
"type": "git",
"url": "https://github.com/composer/xdebug-handler.git",
"reference": "46867cbf8ca9fb8d60c506895449eb799db1184f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f",
"reference": "46867cbf8ca9fb8d60c506895449eb799db1184f",
"shasum": ""
},
"require": {
"php": "^5.3.2 || ^7.0",
"psr/log": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Composer\\XdebugHandler\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "John Stevenson",
"email": "john-stevenson@blueyonder.co.uk"
}
],
"description": "Restarts a process without xdebug.",
"keywords": [
"Xdebug",
"performance"
],
"time": "2019-05-27T17:52:04+00:00"
},
{
"name": "felixfbecker/advanced-json-rpc",
"version": "v3.0.4",
"source": {
"type": "git",
"url": "https://github.com/felixfbecker/php-advanced-json-rpc.git",
"reference": "23366dd0cab0a0f3fd3016bf3c0b36dec74348e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/23366dd0cab0a0f3fd3016bf3c0b36dec74348e7",
"reference": "23366dd0cab0a0f3fd3016bf3c0b36dec74348e7",
"shasum": ""
},
"require": {
"netresearch/jsonmapper": "^1.0",
"php": ">=7.0",
"phpdocumentor/reflection-docblock": "^4.0.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0.0"
},
"type": "library",
"autoload": {
"psr-4": {
"AdvancedJsonRpc\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Felix Becker",
"email": "felix.b@outlook.com"
}
],
"description": "A more advanced JSONRPC implementation",
"time": "2019-09-12T22:41:08+00:00"
},
{
"name": "felixfbecker/language-server",
"version": "v5.4.6",
"source": {
"type": "git",
"url": "https://github.com/felixfbecker/php-language-server.git",
"reference": "1da3328bc23ebd6418529035d357481c8c028640"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/felixfbecker/php-language-server/zipball/1da3328bc23ebd6418529035d357481c8c028640",
"reference": "1da3328bc23ebd6418529035d357481c8c028640",
"shasum": ""
},
"require": {
"composer/xdebug-handler": "^1.0",
"felixfbecker/advanced-json-rpc": "^3.0.0",
"felixfbecker/language-server-protocol": "^1.0.1",
"jetbrains/phpstorm-stubs": "dev-master",
"microsoft/tolerant-php-parser": "0.0.*",
"netresearch/jsonmapper": "^1.0",
"php": "^7.0",
"phpdocumentor/reflection-docblock": "^4.0.0",
"psr/log": "^1.0",
"sabre/event": "^5.0",
"sabre/uri": "^2.0",
"webmozart/glob": "^4.1",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpunit/phpunit": "^6.3",
"squizlabs/php_codesniffer": "^3.1"
},
"bin": [
"bin/php-language-server.php"
],
"type": "library",
"autoload": {
"psr-4": {
"LanguageServer\\": "src/"
},
"files": [
"src/utils.php",
"src/FqnUtilities.php",
"src/ParserHelpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Felix Becker",
"email": "felix.b@outlook.com"
}
],
"description": "PHP Implementation of the Visual Studio Code Language Server Protocol",
"keywords": [
"autocompletion",
"code",
"intellisense",
"language",
"microsoft",
"php",
"refactor",
"server",
"studio",
"visual"
],
"time": "2018-11-13T17:33:21+00:00"
},
{
"name": "felixfbecker/language-server-protocol",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/felixfbecker/php-language-server-protocol.git",
"reference": "378801f6139bb74ac215d81cca1272af61df9a9f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/378801f6139bb74ac215d81cca1272af61df9a9f",
"reference": "378801f6139bb74ac215d81cca1272af61df9a9f",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"phpstan/phpstan": "*",
"phpunit/phpunit": "^6.3",
"squizlabs/php_codesniffer": "^3.1"
},
"type": "library",
"autoload": {
"psr-4": {
"LanguageServerProtocol\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"ISC"
],
"authors": [
{
"name": "Felix Becker",
"email": "felix.b@outlook.com"
}
],
"description": "PHP classes for the Language Server Protocol",
"keywords": [
"language",
"microsoft",
"php",
"server"
],
"time": "2019-06-23T21:03:50+00:00"
},
{
"name": "jetbrains/phpstorm-stubs",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/JetBrains/phpstorm-stubs.git",
"reference": "f3a010af18f763091fe2182b16c041333ba6a7fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/f3a010af18f763091fe2182b16c041333ba6a7fb",
"reference": "f3a010af18f763091fe2182b16c041333ba6a7fb",
"shasum": ""
},
"require-dev": {
"nikic/php-parser": "^4",
"php": "^7.1",
"phpdocumentor/reflection-docblock": "^4.3",
"phpunit/phpunit": "^7"
},
"type": "library",
"autoload": {
"files": [
"PhpStormStubsMap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "PHP runtime & extensions header files for PhpStorm",
"homepage": "https://www.jetbrains.com/phpstorm",
"keywords": [
"autocomplete",
"code",
"inference",
"inspection",
"jetbrains",
"phpstorm",
"stubs",
"type"
],
"time": "2019-09-18T14:39:59+00:00"
},
{
"name": "microsoft/tolerant-php-parser",
"version": "v0.0.18",
"source": {
"type": "git",
"url": "https://github.com/microsoft/tolerant-php-parser.git",
"reference": "e255aa978b45729094da2a1a6f9954044a244ff2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/microsoft/tolerant-php-parser/zipball/e255aa978b45729094da2a1a6f9954044a244ff2",
"reference": "e255aa978b45729094da2a1a6f9954044a244ff2",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Microsoft\\PhpParser\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rob Lourens",
"email": "roblou@microsoft.com"
}
],
"description": "Tolerant PHP-to-AST parser designed for IDE usage scenarios",
"time": "2019-07-01T02:21:00+00:00"
},
{
"name": "netresearch/jsonmapper",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/cweiske/jsonmapper.git",
"reference": "0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06",
"reference": "0d4d1b48d682a93b6bfedf60b88c7750e9cb0b06",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4",
"squizlabs/php_codesniffer": "~1.5"
},
"type": "library",
"autoload": {
"psr-0": {
"JsonMapper": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"OSL-3.0"
],
"authors": [
{
"name": "Christian Weiske",
"role": "Developer",
"email": "cweiske@cweiske.de",
"homepage": "http://github.com/cweiske/jsonmapper/"
}
],
"description": "Map nested JSON structures onto PHP classes",
"time": "2019-08-15T19:41:25+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "~6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2018-08-07T13:53:10+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.3.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
"reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
"shasum": ""
},
"require": {
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"doctrine/instantiator": "^1.0.5",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2019-09-12T14:27:41+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"shasum": ""
},
"require": {
"php": "^7.1",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "^7.1",
"mockery/mockery": "~1",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"time": "2019-08-22T18:11:29+00:00"
},
{
"name": "psr/log",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2018-11-20T15:27:04+00:00"
},
{
"name": "sabre/event",
"version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sabre-io/event.git",
"reference": "f5cf802d240df1257866d8813282b98aee3bc548"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sabre-io/event/zipball/f5cf802d240df1257866d8813282b98aee3bc548",
"reference": "f5cf802d240df1257866d8813282b98aee3bc548",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": ">=6",
"sabre/cs": "~1.0.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Sabre\\Event\\": "lib/"
},
"files": [
"lib/coroutine.php",
"lib/Loop/functions.php",
"lib/Promise/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"role": "Developer",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/"
}
],
"description": "sabre/event is a library for lightweight event-based programming",
"homepage": "http://sabre.io/event/",
"keywords": [
"EventEmitter",
"async",
"coroutine",
"eventloop",
"events",
"hooks",
"plugin",
"promise",
"reactor",
"signal"
],
"time": "2018-03-05T13:55:47+00:00"
},
{
"name": "sabre/uri",
"version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/sabre-io/uri.git",
"reference": "18f454324f371cbcabdad3d0d3755b4b0182095d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sabre-io/uri/zipball/18f454324f371cbcabdad3d0d3755b4b0182095d",
"reference": "18f454324f371cbcabdad3d0d3755b4b0182095d",
"shasum": ""
},
"require": {
"php": ">=7"
},
"require-dev": {
"phpunit/phpunit": "^6"
},
"type": "library",
"autoload": {
"files": [
"lib/functions.php"
],
"psr-4": {
"Sabre\\Uri\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"description": "Functions for making sense out of URIs.",
"homepage": "http://sabre.io/uri/",
"keywords": [
"rfc3986",
"uri",
"url"
],
"time": "2019-09-09T23:00:25+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.12.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "550ebaac289296ce228a706d0867afc34687e3f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4",
"reference": "550ebaac289296ce228a706d0867afc34687e3f4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.12-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2019-08-06T08:03:45+00:00"
},
{
"name": "webmozart/assert",
"version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "88e6d84706d09a236046d686bbea96f07b3a34f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4",
"reference": "88e6d84706d09a236046d686bbea96f07b3a34f4",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2019-08-24T08:43:50+00:00"
},
{
"name": "webmozart/glob",
"version": "4.1.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/glob.git",
"reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/glob/zipball/3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe",
"reference": "3cbf63d4973cf9d780b93d2da8eec7e4a9e63bbe",
"shasum": ""
},
"require": {
"php": "^5.3.3|^7.0",
"webmozart/path-util": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1",
"symfony/filesystem": "^2.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Glob\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "A PHP implementation of Ant's glob.",
"time": "2015-12-29T11:14:33+00:00"
},
{
"name": "webmozart/path-util",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/path-util.git",
"reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
"reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"webmozart/assert": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\PathUtil\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
"time": "2015-12-17T08:42:14+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "7.1.0"
}
}

View File

@ -1,33 +0,0 @@
collectors:
- 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: '
# 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: /
settings:
collect_transitive: true
actors:
- type: php-composer
versions: 'L.L.Y'
settings:
commit_message_prefix: 'fix: '
- type: php-composer
versions: 'L.Y.0'
settings:
commit_message_prefix: 'feat: '
- type: php-composer
versions: 'Y.0.0'
settings:
commit_message_prefix: 'chore: '

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

BIN
images/formatDocument.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

39
images/logo.svg Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="8.5 251.6 553 290.9" style="enable-background:new 8.5 251.6 553 290.9;" xml:space="preserve">
<style type="text/css">
.st0{fill:url(#SVGID_1_);}
.st1{fill:#6682BA;}
.st2{fill:#FFFFFF;}
.st3{fill:#00000E;}
</style>
<title>logo</title>
<radialGradient id="SVGID_1_" cx="148" cy="484" r="363.06" gradientTransform="matrix(1 0 0 -1 26.52 786.69)" gradientUnits="userSpaceOnUse">
<stop offset="0" style="stop-color:#FFFFFF"/>
<stop offset="0.5" style="stop-color:#4D6998"/>
<stop offset="1" style="stop-color:#1D1D1B"/>
</radialGradient>
<ellipse class="st0" cx="285" cy="397" rx="276.5" ry="145.4"/>
<ellipse class="st1" cx="285" cy="397" rx="265.7" ry="134.6"/>
<path class="st2" d="M338.8,440.5l13.2-67.8c3-15.3,0.5-26.7-7.4-33.9c-7.6-7-20.5-10.4-39.5-10.4h-22.8l6.5-33.6
c0.5-2.3-1.1-4.6-3.4-5.1c-0.3-0.1-0.5-0.1-0.8-0.1h-31.5c-2.1,0-3.8,1.5-4.2,3.5l-14,72c-1.1-7.7-4.4-14.9-9.4-20.8
c-9.2-10.6-23.9-15.9-43.4-15.9h-61c-2.1,0-3.8,1.5-4.2,3.5L88.4,477.6c-0.5,2.3,1.1,4.6,3.4,5.1c0.3,0.1,0.5,0.1,0.8,0.1h31.8
c2.1,0,3.8-1.5,4.2-3.5l6.8-35.3h23.6c12.4,0,22.8-1.3,31-4c8.5-2.8,16.2-7.5,22.7-13.6c5.3-4.8,9.8-10.5,13.4-16.7l-5.7,29.1
c-0.5,2.3,1.1,4.6,3.4,5.1c0.3,0.1,0.5,0.1,0.8,0.1h31.5c2.1,0,3.8-1.5,4.2-3.5l15.5-80h21.6c9.2,0,11.9,1.8,12.6,2.6
s2,3.3,0.5,11.3l-12.5,64.5c-0.5,2.3,1.1,4.6,3.4,5.1c0.3,0.1,0.5,0.1,0.8,0.1h32C336.7,444,338.4,442.5,338.8,440.5z M192.8,384.5
c-2,10.2-5.7,17.4-11.1,21.6s-14.2,6.3-26,6.3h-14.1l10.2-52.4H170c13.4,0,18.8,2.9,20.9,5.3C193.9,368.6,194.6,375.2,192.8,384.5
L192.8,384.5z"/>
<path class="st2" d="M473.5,344.3c-9.2-10.6-23.9-15.9-43.4-15.9H369c-2.1,0-3.8,1.5-4.2,3.5l-28.3,145.8c-0.5,2.3,1.1,4.6,3.4,5.1
c0.3,0.1,0.5,0.1,0.8,0.1h31.8c2.1,0,3.8-1.5,4.2-3.5l6.9-35.3h23.6c12.4,0,22.8-1.3,31-4c8.5-2.8,16.2-7.5,22.7-13.6
c11.1-10,18.6-23.4,21.3-38.1C485.7,369.8,482.8,355,473.5,344.3z M440.6,384.5c-2,10.2-5.7,17.4-11.1,21.6s-14.2,6.3-26,6.3h-14.1
l10.2-52.4h18.2c13.4,0,18.8,2.9,20.9,5.3C441.8,368.6,442.4,375.2,440.6,384.5z"/>
<path class="st3" d="M170,355.7c12.1,0,20.1,2.2,24.1,6.7c4,4.5,5,12.1,2.9,22.9c-2.2,11.3-6.4,19.3-12.7,24.2s-15.8,7.2-28.6,7.2
h-19.3l11.9-61H170z M92.7,478.4h31.8l7.6-38.8h27.2c12,0,21.9-1.3,29.6-3.8c7.9-2.6,15.1-6.9,21.1-12.7
c10.4-9.4,17.4-21.9,19.9-35.7c3.3-17.3,0.8-30.7-7.6-40.4c-8.4-9.6-21.8-14.5-40.2-14.5H121L92.7,478.4z"/>
<path class="st3" d="M253.2,293.9h31.5l-7.5,38.8h28.1c17.7,0,29.8,3.1,36.5,9.2c6.7,6.2,8.7,16.1,6,29.9l-13.2,67.8h-32l12.5-64.5
c1.4-7.3,0.9-12.3-1.6-15c-2.5-2.7-7.7-4-15.8-4h-25.2l-16.2,83.5h-31.5L253.2,293.9z"/>
<path class="st3" d="M417.8,355.7c12.1,0,20.1,2.2,24.1,6.7c4,4.5,5,12.1,2.9,22.9c-2.2,11.3-6.4,19.3-12.7,24.2s-15.8,7.2-28.6,7.2
h-19.3l11.9-61H417.8z M340.5,478.4h31.8l7.5-38.8H407c12,0,21.9-1.3,29.6-3.8c7.9-2.6,15.1-6.9,21.1-12.7
c10.4-9.4,17.4-21.9,19.9-35.7c3.3-17.3,0.8-30.7-7.6-40.4c-8.4-9.6-21.8-14.5-40.2-14.5h-61.1L340.5,478.4z"/>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 KiB

10803
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,12 @@
"description": "Advanced Autocompletion and Refactoring support for PHP", "description": "Advanced Autocompletion and Refactoring support for PHP",
"publisher": "felixfbecker", "publisher": "felixfbecker",
"author": "Felix Becker <felix.b@outlook.com>", "author": "Felix Becker <felix.b@outlook.com>",
"license": "MIT", "license": "ISC",
"private": true, "private": true,
"preview": false, "preview": true,
"version": "1.5.4", "version": "0.0.6",
"engines": { "engines": {
"vscode": "^1.26.1" "vscode": "^1.4.0"
}, },
"keywords": [ "keywords": [
"php", "php",
@ -19,9 +19,9 @@
"refactor" "refactor"
], ],
"categories": [ "categories": [
"Programming Languages" "Languages"
], ],
"icon": "images/logo.png", "icon": "images/logo.svg",
"galleryBanner": { "galleryBanner": {
"color": "#6682BA", "color": "#6682BA",
"theme": "dark" "theme": "dark"
@ -34,89 +34,24 @@
"url": "https://github.com/felixfbecker/php-language-server/issues" "url": "https://github.com/felixfbecker/php-language-server/issues"
}, },
"activationEvents": [ "activationEvents": [
"onLanguage:php", "onLanguage:php"
"workspaceContains:**/*.php"
], ],
"main": "./out/extension", "main": "./out/extension",
"husky": {
"hooks": {
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
},
"scripts": { "scripts": {
"build": "tsc -p .", "compile": "node ./node_modules/vscode/bin/compile -p ./",
"watch": "tsc -w -p .", "watch": "node ./node_modules/vscode/bin/compile -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install", "postinstall": "node ./node_modules/vscode/bin/install",
"lint": "npm run prettier && npm run tslint", "lint": "tslint -c tslint.json \"src/**/*.ts\""
"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"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "7.2.1", "tslint": "^3.15.1",
"@commitlint/config-conventional": "7.1.2", "typescript": "^1.8.10",
"@types/execa": "0.9.0", "typings": "^1.3.3",
"@types/mocha": "5.2.7", "vsce": "^1.8.1",
"@types/mz": "0.0.32", "vscode": "^0.11.17"
"@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"
}, },
"dependencies": { "dependencies": {
"execa": "1.0.0", "semver": "^5.3.0",
"mz": "2.7.0", "vscode-languageclient": "^2.4.2-next.24"
"semver": "6.3.0",
"vscode-languageclient": "5.1.1"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"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"
}
]
},
"contributes": {
"configuration": {
"type": "object",
"title": "PHP IntelliSense",
"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).",
"pattern": "^\\d+[KMG]?$"
},
"php.executablePath": {
"type": [
"string",
"null"
],
"default": null,
"description": "The path to a PHP 7+ executable."
}
}
}
} }
} }

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,67 @@
import execa from 'execa' 'use strict';
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')
export async function activate(context: vscode.ExtensionContext): Promise<void> { import * as path from 'path';
const conf = vscode.workspace.getConfiguration('php') import { spawn, execFile, ChildProcess } from 'child_process';
const executablePath = import * as vscode from 'vscode';
conf.get<string>('executablePath') || import { LanguageClient, LanguageClientOptions, StreamInfo } from 'vscode-languageclient';
conf.get<string>('validate.executablePath') || import * as semver from 'semver';
(process.platform === 'win32' ? 'php.exe' : 'php')
const memoryLimit = conf.get<string>('memoryLimit') || '4095M' export function activate(context: vscode.ExtensionContext) {
if (memoryLimit !== '-1' && !/^\d+[KMG]?$/.exec(memoryLimit)) { // Check if PHP is available and version is ^7.0.0
const selected = await vscode.window.showErrorMessage( execFile('php', ['--version'], (err: NodeJS.ErrnoException, stdout: Buffer, stderr: Buffer) => {
'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')
}
return
}
// Check path (if PHP is available and version is ^7.0.0) if (err) {
let stdout: string
try {
stdout = await execa.stdout(executablePath, ['--version'])
} catch (err) {
if (err.code === 'ENOENT') { if (err.code === 'ENOENT') {
const selected = await vscode.window.showErrorMessage( vscode.window.showErrorMessage('PHP executable not found. You need PHP 7 installed and in your PATH');
'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')
}
} else { } else {
vscode.window.showErrorMessage('Error spawning PHP: ' + err.message) vscode.window.showErrorMessage('Error spawning PHP: ' + err.message);
console.error(err) console.error(err);
} }
return return;
} }
// Parse version and discard OS info like 7.0.8--0ubuntu0.16.04.2 // Parse version and discard OS info like 7.0.8--0ubuntu0.16.04.2
const match = stdout.match(/^PHP ([^\s]+)/m) let version = stdout.toString().match(/^PHP ([^\s]+)/)[1].split('-')[0];
if (!match) {
vscode.window.showErrorMessage('Error parsing PHP version. Please check the output of php --version')
return
}
let version = match[1].split('-')[0]
// Convert PHP prerelease format like 7.0.0rc1 to 7.0.0-rc1 // Convert PHP prerelease format like 7.0.0rc1 to 7.0.0-rc1
if (!/^\d+.\d+.\d+$/.test(version)) { 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)) { if (!semver.satisfies(version, '^7.0.0')) {
vscode.window.showErrorMessage('The language server needs at least PHP 7.1 installed. Version found: ' + version) vscode.window.showErrorMessage('The language server needs at least PHP 7 installed and in your PATH. Version found: ' + version);
return return;
} }
let client: LanguageClient const serverOptions = (): Promise<ChildProcess | StreamInfo> => {
const serverOptions = () =>
new Promise<ChildProcess | StreamInfo>((resolve, reject) => {
// Use a TCP socket because of problems with blocking STDIO
const server = net.createServer(socket => {
// 'connection' listener
console.log('PHP process connected')
socket.on('end', () => {
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 // The server is implemented in PHP
const childProcess = spawn(executablePath, [ const serverPath = context.asAbsolutePath(path.join('vendor', 'felixfbecker', 'language-server', 'bin', 'php-language-server.php'));
context.asAbsolutePath( const childProcess = spawn('php', [serverPath]);
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) => { childProcess.stderr.on('data', (chunk: Buffer) => {
const str = chunk.toString() console.error(chunk + '');
console.log('PHP Language Server:', str) });
client.outputChannel.appendLine(str) childProcess.stdout.on('data', (chunk: Buffer) => {
}) console.log(chunk + '');
// childProcess.stdout.on('data', (chunk: Buffer) => { });
// console.log('PHP Language Server:', chunk + ''); return Promise.resolve(childProcess);
// }); };
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
})
})
// Options to control the language client // Options to control the language client
const clientOptions: LanguageClientOptions = { let clientOptions: LanguageClientOptions = {
// Register the server for php documents // Register the server for php documents
documentSelector: [{ scheme: 'file', language: 'php' }, { scheme: 'untitled', language: 'php' }], documentSelector: ['php']
revealOutputChannelOn: RevealOutputChannelOn.Never, // synchronize: {
uriConverters: { // // Synchronize the setting section 'php' to the server
// VS Code by default %-encodes even the colon after the drive letter // configurationSection: 'php',
// NodeJS handles it much better // // Notify the server about file changes to composer.json files contain in the workspace
code2Protocol: uri => url.format(url.parse(uri.toString(true))), // fileEvents: workspace.createFileSystemWatcher('**/composer.json')
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'),
},
}
// Create the language client and start the client. // Create the language client and start the client.
client = new LanguageClient('PHP Language Server', serverOptions, clientOptions) const disposable = new LanguageClient('PHP Language Client', serverOptions, clientOptions).start();
const disposable = client.start()
// Push the disposable to the context's subscriptions so that the // Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation // 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 // 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 // You can import and use all API from the 'vscode' module
// as well as import your extension to test it // 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 // Defines a Mocha test suite to group tests of similar kind together
suite('Extension Tests', () => { suite('Extension Tests', () => {
// Defines a Mocha unit test // Defines a Mocha unit test
test('Something 1', () => { test('Something 1', () => {
assert.equal(-1, [1, 2, 3].indexOf(5)) assert.equal(-1, [1, 2, 3].indexOf(5));
assert.equal(-1, [1, 2, 3].indexOf(0)) 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 // to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none. // 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 // 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 // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({ testRunner.configure({
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true, // colored output from test results useColors: true // colored output from test results
}) });
module.exports = testRunner module.exports = testRunner;

View File

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

View File

@ -1,85 +1,47 @@
{ {
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": { "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, "class-name": true,
"comment-format": [true, "check-space"], "comment-format": [true, "check-space"],
"curly": true, "indent": [true, "spaces"],
"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-duplicate-variable": true,
"no-empty": true,
"no-empty-interface": false,
"no-eval": true, "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-internal-module": true,
"no-invalid-template-strings": true, "no-trailing-whitespace": 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-var-keyword": true, "no-var-keyword": true,
"no-var-requires": false, "one-line": [true, "check-catch", "check-finally", "check-else", "check-open-brace", "check-whitespace"],
"no-void-expression": false, "quotemark": [true, "single"],
"object-literal-shorthand": true, "semicolon": [true, "always"],
"object-literal-sort-keys": false, "triple-equals": [true, "allow-null-check"],
"one-variable-per-declaration": [true, "ignore-for-loop"], "typedef-whitespace": [
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": [
true, 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, "variable-name": [true, "ban-keywords"],
"prefer-template": [false, "allow-single-concat"], "whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"],
"return-undefined": true, "jsdoc-format": true,
"triple-equals": [true], "no-consecutive-blank-lines": true,
"typedef": [true, "call-signature"], "one-variable-per-declaration": [true, "ignore-for-loop"],
"unified-signatures": true, "curly": true,
"variable-name": [true, "ban-keywords"] "no-empty": true,
"no-duplicate-key": true,
"no-unreachable": true,
"no-unused-expression": true,
"no-unused-variable": [true],
"eofline": true,
"trailing-comma": [true, {"singleline": "never", "multiline": "never"}],
"align": [true, "parameters", "statements"]
} }
} }

5
typings.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"semver": "registry:npm/semver#5.0.0+20160723033700"
}
}

1
typings/node.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference path="../node_modules/vscode/typings/node.d.ts" />

1
typings/vscode-typings.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference path="../node_modules/vscode/typings/index.d.ts" />