Make vim config much simpler. Use vscode for anything fancy

This commit is contained in:
Anthony Rose 2021-09-14 16:40:57 +01:00
parent 76539f02bd
commit f4c56a56d3
1348 changed files with 0 additions and 368071 deletions

View file

@ -1,219 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.

View file

@ -1,70 +0,0 @@
# coc-clangd
This extension connects [coc.nvim][] to the [clangd][] language server.
## Quick Start
1. install [Node.js][]. `coc.nvim` and `coc-clangd` run on Node.js.
1. install `coc.nvim`. Instructions using `vim-plug` (check out [coc.nvim Wiki][] other options):
- add to `.vimrc`: `vim Plug 'neoclide/coc.nvim', {'branch': 'release'}`
- in vim, run `:PlugInstall`
1. in vim, run `:CocInstall coc-clangd`
1. `coc-clangd` will try to find `clangd` from your `$PATH`, if not found, you can run `:CocCommand clangd.install` to install the [latest release][] from GitHub
1. follow [Project setup][] to generate `compile_commands.json` for your project
> **Note**: If you've configured `clangd` as a languageServer in `coc-settings.json`, you should remove it to avoid running clangd twice!
## Protocol extensions
`clangd` supports some [extensions][] that are not in the official [Language Server Protocol specification][lsp].
`coc-clangd` adds support for:
- Switching between header and implementation file: `:CocCommand clangd.switchSourceHeader`
- File status monitor, shows on NeoVim statusline
- Describe symbol under the cursor: `:CocCommand clangd.symbolInfo`
- Completions that adjust text near the cursor (e.g. correcting `.` to `->`)
## Configurations
`:CocConfig` opens your global `coc-settings.json`, or `:CocLocalConfig` opens local configuration in your project `.vim/coc-settings.json`.
| Configurations | Description | Default |
| -- | -- | -- |
| clangd.enabled | enable `coc-clangd` | `true` |
| clangd.arguments | arguments for `clangd` server | `[]` |
| clangd.checkUpdates | check for clangd language server updates on startup | `false` |
| clangd.disableCompletion | disable completion source from clangd | `false` |
| clangd.disableDiagnostics | disable diagnostics from clangd | `false` |
| clangd.disableSnippetCompletion | disable completion snippet from clangd | `false` |
| clangd.compilationDatabasePath | specifies the directory containing the compilation database | `''` |
| clangd.fallbackFlags | extra clang flags used to parse files when no compilation database is found | `[]` |
| clangd.path | path to `clangd` executable | `clangd` |
| clangd.semanticHighlighting | enable semantic highlighting, requires [jackguo380/vim-lsp-cxx-highlight](https://github.com/jackguo380/vim-lsp-cxx-highlight) to work | `false` |
| clangd.serverCompletionRanking | always rank compilation items on the server as you type | `true` |
## Commands
- `clangd.switchSourceHeader`: switch between source/header files
- `clangd.symbolInfo`: resolve symbol info under the cursor
- `clangd.install`: install latest clangd release from GitHub
- `clangd.update`: check for updates to clangd from GitHub
## License
Apache 2.0 with LLVM Exception
This is the [standard LLVM license](https://llvm.org/foundation/relicensing/).
---
> This extension is created by [create-coc-extension](https://github.com/fannheyward/create-coc-extension)
[node.js]: https://nodejs.org/en/
[clangd]: https://clangd.llvm.org/installation.html
[coc.nvim]: https://github.com/neoclide/coc.nvim
[coc.nvim wiki]: https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim
[lsp]: https://microsoft.github.io/language-server-protocol/specification
[extensions]: https://clangd.llvm.org/extensions.html
[latest release]: https://github.com/clangd/clangd/releases
[project setup]: https://clangd.llvm.org/installation.html#project-setup

View file

@ -1,33 +0,0 @@
/* eslint-disable @typescript-eslint/no-var-requires */
async function start(watch) {
await require('esbuild').build({
entryPoints: ['src/index.ts'],
bundle: true,
watch,
minify: process.env.NODE_ENV === 'production',
sourcemap: process.env.NODE_ENV === 'development',
mainFields: ['module', 'main'],
external: ['coc.nvim'],
platform: 'node',
target: 'node10.12',
outfile: 'lib/index.js',
});
}
let watch = false;
if (process.argv.length > 2 && process.argv[2] === '--watch') {
console.log('watching...');
watch = {
onRebuild(error) {
if (error) {
console.error('watch build failed:', error);
} else {
console.log('watch build succeeded');
}
},
};
}
start(watch).catch((e) => {
console.error(e);
});

File diff suppressed because it is too large Load diff

View file

@ -1,166 +0,0 @@
{
"name": "coc-clangd",
"version": "0.9.0",
"description": "clangd extension for coc.nvim",
"author": "Heyward Fann <fannheyward@gmail.com>",
"license": "Apache-2.0 WITH LLVM-exception",
"main": "lib/index.js",
"keywords": [
"coc.nvim"
],
"engines": {
"coc": "^0.0.80"
},
"repository": {
"type": "git",
"url": "https://github.com/clangd/coc-clangd.git"
},
"scripts": {
"clean": "rimraf lib",
"build": "node esbuild.js",
"lint": "eslint src --ext ts",
"prepare": "node esbuild.js"
},
"devDependencies": {
"@clangd/install": "^0.1.3",
"@types/node": "10.12.0",
"@types/which": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"coc.nvim": "^0.0.81-next.2",
"esbuild": "^0.8.42",
"eslint": "^7.11.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.1.2",
"rimraf": "^3.0.1",
"typescript": "^4.0.3",
"vscode-languageserver-protocol": "^3.15.3"
},
"activationEvents": [
"onLanguage:c",
"onLanguage:cpp",
"onLanguage:cuda",
"onLanguage:objc",
"onLanguage:objcpp",
"onLanguage:arduino",
"onLanguage:objective-c",
"onLanguage:objective-cpp",
"workspaceContains:**/compile_commands.json",
"workspaceContains:**/compile_flags.txt"
],
"rootPatterns": [
{
"patterns": [
"compile_commands.json",
"compile_flags.txt"
]
}
],
"contributes": {
"configuration": {
"type": "object",
"title": "coc-clangd configuration",
"properties": {
"clangd.enabled": {
"type": "boolean",
"default": true,
"description": "Enable coc-clangd extension"
},
"clangd.disableDiagnostics": {
"type": "boolean",
"default": false,
"description": "Disable diagnostics from clangd"
},
"clangd.disableCompletion": {
"type": "boolean",
"default": false,
"description": "Disable completion source from clangd"
},
"clangd.disableSnippetCompletion": {
"type": "boolean",
"default": false,
"description": "Disable completion snippet from clangd"
},
"clangd.compilationDatabasePath": {
"type": "string",
"default": "",
"description": "Specifies the directory containing the compilation database"
},
"clangd.path": {
"type": "string",
"default": "clangd",
"description": "The path to clangd executable, e.g.: /usr/bin/clangd"
},
"clangd.arguments": {
"type": "array",
"default": [],
"items": {
"type": "string"
},
"description": "Arguments for clangd server"
},
"clangd.trace": {
"type": "string",
"description": "Names a file that clangd should log a performance trace to, in chrome trace-viewer JSON format."
},
"clangd.fallbackFlags": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Extra clang flags used to parse files when no compilation database is found."
},
"clangd.semanticHighlighting": {
"type": "boolean",
"default": false,
"description": "Enable semantic highlighting in clangd, requires jackguo380/vim-lsp-cxx-highlight to work"
},
"clangd.showDBChangedNotification": {
"type": "boolean",
"default": true,
"description": "Show notifications while DB files changed"
},
"clangd.serverCompletionRanking": {
"type": "boolean",
"default": true,
"description": "Always rank completion items on the server as you type. This produces more accurate results at the cost of higher latency than client-side filtering."
},
"clangd.checkUpdates": {
"type": "boolean",
"default": false,
"description": "Check for clangd language server updates on startup."
},
"suggest.detailMaxLength": {
"type": "number",
"description": "Max length of detail that should be shown in popup menu.",
"default": 50
},
"diagnostic.format": {
"type": "string",
"description": "Define the diagnostic format. Available parts: source, code, severity, message",
"default": "%message\n[%source:%code]"
}
}
},
"commands": [
{
"command": "clangd.switchSourceHeader",
"title": "Switch between source/header"
},
{
"command": "clangd.symbolInfo",
"title": "Resolve symbol info under the cursor"
},
{
"command": "clangd.install",
"title": "Install latest clangd language server binary release"
},
{
"command": "clangd.update",
"title": "Check for updates to clangd language server"
}
]
}
}

View file

@ -1,12 +0,0 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
indent_size = 4

View file

@ -1,2 +0,0 @@
/lib
node_modules

View file

@ -1,17 +0,0 @@
{
"root": true,
"extends": ["josa-typescript"],
"env": {
"mocha": true
},
"rules": {
"no-extra-semi": "error",
"sort-imports": [
"error",
{
"ignoreCase": false,
"ignoreDeclarationSort": true
}
]
}
}

View file

@ -1,19 +0,0 @@
name: Main
on: push
jobs:
main:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [10, 12] # 14
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with: { node-version: "${{ matrix.node }}" }
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn lint
- run: yarn test

View file

@ -1,32 +0,0 @@
name: update-settings
on:
push:
schedule:
- cron: '0 * * * *'
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with: { node-version: '12' }
- run: ./scripts/update-commands.js
- run: ./scripts/update-options.js
- run: ./scripts/update-options-interface.js
- run: ./scripts/update-snippets.js
- run: ./scripts/update-tables.sh
- run: git diff
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn lint
- run: yarn test
- uses: EndBug/add-and-commit@v5
with:
push: true
author_name: Github Action
author_email: josa@gesell.me
message: '[auto] Update Settings'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'

View file

@ -1,11 +0,0 @@
{
"coc.preferences.formatOnSaveFiletypes": ["javascript", "typescript", "json"],
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"javascript.format.semicolons": "remove",
"eslint.autoFix": true,
"eslint.autoFixOnSave": true,
"prettier.disableLanguages": ["typescript"]
}

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2020 Josa Gesell
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,185 +0,0 @@
# coc-go
Go language server extension using [`gopls`](https://github.com/golang/go/wiki/gopls)
for [`coc.nvim`](https://github.com/neoclide/coc.nvim).
## Install
In your vim/neovim, run this command:
```
:CocInstall coc-go
```
## Features
See [`gopls`](https://github.com/golang/tools/blob/master/gopls/README.md)
## Commands
Additional to commands provided by gopls, this extensions provides these commands:
| Key | Description |
|---------------------------------|----------------------------------------------------|
| **`go.impl.cursor`** | Generate interface stubs |
| **`go.install.gomodifytags`** | Install / update gomodifytags |
| **`go.install.goplay`** | Install / update goplay |
| **`go.install.gopls`** | Install / update gopls |
| **`go.install.gotests`** | Install / update gotests |
| **`go.install.impl`** | Install / update impl |
| **`go.install.tools`** | Install / update all tools |
| **`go.playground`** | Run on go playground |
| **`go.tags.add`** | Add tags to struct fields |
| **`go.tags.add.line`** | Add tags to struct field in current line |
| **`go.tags.add.prompt`** | Add tags to struct fields (prompt) |
| **`go.tags.clear`** | Remove all tags from struct fields |
| **`go.tags.clear.line`** | Remove all tags from struct fields in current line |
| **`go.tags.remove`** | Remove tags from struct fields |
| **`go.tags.remove.line`** | Remove tags from struct field in current line |
| **`go.tags.remove.prompt`** | Remove tags from struct fields (prompt) |
| **`go.test.generate.exported`** | Generate unit tests for exported functions in file |
| **`go.test.generate.file`** | Generate unit tests for file |
| **`go.test.generate.function`** | Generate unit tests for current function |
| **`go.test.toggle`** | Toggle test file |
| **`go.version`** | Print extension version |
### Examples
- **Add or Remove specific tags**
```
CocCommand go.tags.add yaml
CocCommand go.tags.add yaml json xml
CocCommand go.tags.remove xml
```
- **Add missing imports on save**
```viml
autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport')
```
- **Map Keys to command**
```viml
autocmd FileType go nmap gtj :CocCommand go.tags.add json<cr>
autocmd FileType go nmap gty :CocCommand go.tags.add yaml<cr>
autocmd FileType go nmap gtx :CocCommand go.tags.clear<cr>
```
## Snippets
Snippets are imported from [`microsoft/vscode-go`](https://github.com/microsoft/vscode-go)
and require [`coc-snippets`](https://github.com/neoclide/coc-snippets) to be
installed.
## Configuration options
| Key | Description | Default |
|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|
| **`go.checkForUpdates`** | **EXPERIMENTAL** Check for gopls updates on start. | disabled |
| **`go.disable`** | Disable gopls features | {} |
| ‣ `completion` | Disable completion feature (Change requires `:CocRestart`) | false |
| ‣ `diagnostics` | Disable handle diagnostics (Change requires `:CocRestart`) | false |
| ‣ `workspaceFolders` | Disable workspaceFolders feature (Change requires `:CocRestart`) | false |
| **`go.enable`** | Enable Go extension | true |
| **`go.goplsArgs`** | Arguments passed to `gopls` (Change requires `:CocRestart`) | |
| **`go.goplsEnv`** | ENV passed to `gopls` (Change requires `:CocRestart`) | |
| **`go.goplsOptions`** | See [`gopls` documentation](https://github.com/golang/tools/blob/master/gopls/doc/settings.md ) | |
| ‣ `allowImplicitNetworkAccess` | **This setting is experimental and may be deleted.** allowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module downloads rather than requiring user action. | false |
| ‣ `allowModfileModifications` | **This setting is experimental and may be deleted.** allowModfileModifications disables -mod=readonly, allowing imports from out-of-scope modules. | false |
| ‣ `analyses` | analyses specify analyses that the user would like to enable or disable. | |
| ‣ `annotations` | **This setting is experimental and may be deleted.** annotations specifies the various kinds of optimization diagnostics that should be reported by the gc_details command. | |
| ‣ `buildFlags` | buildFlags is the set of flags passed on to the build system when invoked. | |
| ‣ `codelenses` | codelenses overrides the enabled/disabled state of code lenses. | |
| ‣ `completionBudget` | **This setting is for debugging purposes only.** completionBudget is the soft latency goal for completion requests. | 100ms |
| ‣ `directoryFilters` | directoryFilters can be used to exclude unwanted directories from the workspace. | |
| ‣ `env` | env adds environment variables to external commands run by `gopls`, most notably `go list`. | |
| ‣ `expandWorkspaceToModule` | **This setting is experimental and may be deleted.** expandWorkspaceToModule instructs `gopls` to adjust the scope of the workspace to find the best available module root. | true |
| ‣ `experimentalDiagnosticsDelay` | **This setting is experimental and may be deleted.** experimentalDiagnosticsDelay controls the amount of time that gopls waits after the most recent file modification before computing deep diagnostics. | 250ms |
| ‣ `experimentalPackageCacheKey` | **This setting is experimental and may be deleted.** experimentalPackageCacheKey controls whether to use a coarser cache key for package type information to increase cache hits. | true |
| ‣ `experimentalWorkspaceModule` | **This setting is experimental and may be deleted.** experimentalWorkspaceModule opts a user into the experimental support for multi-module workspaces. | false |
| ‣ `gofumpt` | gofumpt indicates if we should run gofumpt formatting. | false |
| ‣ `hoverKind` | hoverKind controls the information that appears in the hover text. | FullDocumentation |
| ‣ `importShortcut` | importShortcut specifies whether import statements should link to documentation or go to definitions. | Both |
| ‣ `linkTarget` | linkTarget controls where documentation links go. | pkg.go.dev |
| ‣ `linksInHover` | linksInHover toggles the presence of links to documentation in hover. | true |
| ‣ `local` | local is the equivalent of the `goimports -local` flag, which puts imports beginning with this string after third-party packages. | |
| ‣ `matcher` | **This is an advanced setting and should not be configured by most `gopls` users.** matcher sets the algorithm that is used when calculating completion candidates. | Fuzzy |
| ‣ `semanticTokens` | **This setting is experimental and may be deleted.** semanticTokens controls whether the LSP server will send semantic tokens to the client. | false |
| ‣ `staticcheck` | **This setting is experimental and may be deleted.** staticcheck enables additional analyses from staticcheck.io. | false |
| ‣ `symbolMatcher` | **This is an advanced setting and should not be configured by most `gopls` users.** symbolMatcher sets the algorithm that is used when finding workspace symbols. | Fuzzy |
| ‣ `symbolStyle` | **This is an advanced setting and should not be configured by most `gopls` users.** symbolStyle controls how symbols are qualified in symbol responses. | Dynamic |
| ‣ `usePlaceholders` | placeholders enables placeholders for function parameters or struct fields in completion responses. | false |
| ‣ `verboseOutput` | **This setting is for debugging purposes only.** verboseOutput enables additional debug logging. | false |
| **`go.goplsPath`** | Path to `gopls` bin (Change requires `:CocRestart`) | |
| **`go.goplsUseDaemon`** | Run gopls as daemon | true |
| **`go.tags`** | | |
| ‣ `options` | Comma separated tag=options pairs to be used by `go.tags.add` command | json=omitempty |
| ‣ `skipUnexported` | If true, skip unexported fields | false |
| ‣ `tags` | Comma separated tags to be used by `go.tags.add` command | json |
| ‣ `transform` | Transformation rule used by `go.tags.add` command to add tags | snakecase |
| **`go.tests`** | | |
| ‣ `generateFlags` | Additional command line flags to pass to `gotests` for generating tests. | [] |
| **`go.trace.server`** | Trace level of gopls | off |
Trigger completion in `coc-settings.json` to get complete list.
### Example Configuration
```json
{
"go.goplsOptions": {
"completeUnimported": true
}
}
```
## Development
1. Run `yarn build` or `yarn build:watch`
2. Link extension: `yarn run link` / `yarn run unlink`
## Tools
- [`gomodifytags`](http://github.com/fatih/gomodifytags) - [BSD](https://github.com/fatih/gomodifytags/blob/master/LICENSE)
- [`goplay`](http://github.com/haya14busa/goplay) - [MIT](https://github.com/haya14busa/goplay/blob/master/LICENSE)
- [`gopls`](https://golang.org/x/tools/cmd/gopls)
- [`gotests`](http://github.com/cweill/gotests) - [Apache](https://github.com/cweill/gotests/blob/develop/LICENSE)
- [`impl`](https://github.com/josharian/impl) - [MIT](https://github.com/josharian/impl/blob/master/LICENSE.txt)
## FAQ
### How does `coc-go` compare to `vim-go`?
With `coc-go` I do not aim to recreate the features of `vim-go`. For now, the
main goal is to provide a convenient way to install `gopls` and use it with
`coc.nvim`.
If you need more than the features provided by `gopls`, you are probably better
of with [`vim-go`](https://github.com/fatih/vim-go) or
[`govim`](https://github.com/govim/govim).
### How to use `coc-go` with wasm?
Add this to you (local) `coc-settings.json` (run `:CocLocalConfig`).
```json
{
"go.goplsEnv": {
"GOOS": "js",
"GOARCH": "wasm",
}
}
```
### Running `gopls` as a daemon
`coc-go` runs `gopls` as shared daemon by passing `-remote=auto` to `gopls`. To
disable this behavior set `go.goplsUseDaemon` to `false`.
See [Running gopls as a daemon](https://github.com/golang/tools/blob/master/gopls/doc/daemon.md) for more information.
## License
[MIT © Josa Gesell](LICENSE).

View file

@ -1,20 +0,0 @@
FROM alpine
RUN apk add --no-cache \
bash \
neovim \
curl \
nodejs \
yarn \
go
RUN \
mkdir -p ~/.local/share/nvim/site/pack/coc/start \
&& cd ~/.local/share/nvim/site/pack/coc/start \
&& curl -sS --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv -
RUN nvim -c 'CocInstall -sync coc-go |q' +qall
RUN mkdir -p /root/.config/nvim/undo
ADD init.vim /root/.config/nvim/init.vim
WORKDIR /workdir

View file

@ -1,196 +0,0 @@
set number " Show: Line numbers
set cursorline " Hilight current curser line
set noshowmode " Hide: -- INSERT --
set listchars=tab:»\ ,extends:,precedes:,nbsp,space,trail
set list " Show white space
set tabstop=2
set shiftwidth=2
set expandtab
set nowrap
set colorcolumn=80,120
set mouse=a
" set clipboard+=unnamedplus
set nobackup
set noswapfile
set undodir=~/.config/nvim/undo
set undofile
set conceallevel=0
autocmd BufEnter * if &filetype != 'nerdtree' && &filetype != 'help' | set conceallevel=0 | endif
set cmdheight=1
set shortmess+=c
set signcolumn=yes
set updatetime=300
set hidden
set spell spelllang=en_us,de_de
set splitbelow
set splitright
highlight clear CocHighlightText
highlight CocHighlightText cterm=underline gui=underline
set hlsearch " Highlight search results.
set ignorecase " Make searching case insensitive
set smartcase " ... unless the query has capital letters.
set incsearch " Incremental search.
set gdefault " Use 'g' flag by default with :s/foo/bar/.
set magic " Use 'magic' patterns (extended regular expressions).
set nofoldenable " Never fold (by defauld, override for sim languages)
set inccommand=split
exec 'set wildignore=' . join([
\ '.sass-cache',
\ '\.DS_Store',
\ '\.git$',
\ '\~$',
\ '\.swp$',
\ 'gin-bin',
\ '*/node_modules/*',
\ ], ',')
set noautochdir
set signcolumn=yes
set autoread
let &scrolloff = 4
if exists('##CompleteChanged') && exists('*nvim_open_win')
set pumblend=10
set wildoptions=pum
endif
let mapleader=","
let maplocalleader = "-"
"
" select tabs
nnoremap <silent><Tab> :tabnext<CR>
nnoremap <silent><S-Tab> :tabprevious<CR>
" move tabs
nnoremap <silent>m<Tab> :tabm +1<CR>
nnoremap <silent>m<S-Tab> :tabm -1<CR>
" open and close tabs
" nnoremap <silent><C-t> :tabnew<CR>
nnoremap <silent><C-q> :quit<CR>
nnoremap <silent><C-t> :split term://zsh<CR>i
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current line.
nmap <leader>ac <Plug>(coc-codeaction-line)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Introduce function text object
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <TAB> for selections ranges.
" NOTE: Requires 'textDocument/selectionRange' support from the language server.
" coc-tsserver, coc-python are the examples of servers that support it.
" nmap <silent> <TAB> <Plug>(coc-range-select)
xmap <silent> <TAB> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Mappings using CoCList:
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
nnoremap <leader>d :CocFzfList diagnostics --current-buf<cr>
nnoremap <leader>c :CocFzfList commands<cr>
nnoremap <leader>o :CocFzfList outline<cr>
nnoremap <leader>s :CocFzfList symbols<cr>
" nnoremap <leader>j :<C-u>CocNext<CR>
" nnoremap <leader>k :<C-u>CocPrev<CR>
autocmd BufWritePre *.go :call CocAction('organizeImport')
autocmd FileType go nmap <buffer> gta :call CocAction('runCommand', 'go.tags.add')<cr>
autocmd FileType go nmap <buffer> gtl :call CocAction('runCommand', 'go.tags.add.line')<cr>
autocmd FileType go nmap <buffer> gtr :call CocAction('runCommand', 'go.tags.remove')<cr>
autocmd FileType go nmap <buffer> gtj :call CocAction('runCommand', 'go.tags.add', 'json')<cr>
autocmd FileType go nmap <buffer> gty :call CocAction('runCommand', 'go.tags.add', 'yaml')<cr>
autocmd FileType go nmap <buffer> gtx :call CocAction('runCommand', 'go.tags.clear')<cr>

View file

@ -1,16 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TOOLS = exports.IMPL = exports.GOPLAY = exports.GOTESTS = exports.GOMODIFYTAGS = exports.GOPLS = void 0;
exports.GOPLS = 'golang.org/x/tools/gopls';
exports.GOMODIFYTAGS = 'github.com/fatih/gomodifytags';
exports.GOTESTS = "github.com/cweill/gotests/...";
exports.GOPLAY = "github.com/haya14busa/goplay/cmd/goplay";
exports.IMPL = "github.com/josharian/impl";
exports.TOOLS = [
exports.GOPLS,
exports.GOMODIFYTAGS,
exports.GOTESTS,
exports.GOPLAY,
exports.IMPL,
];
//# sourceMappingURL=binaries.js.map

View file

@ -1,104 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.installTools = exports.installImpl = exports.installGoplay = exports.installGotests = exports.installGomodifytags = exports.checkGopls = exports.installGopls = exports.version = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const coc_nvim_1 = require("coc.nvim");
const tools_1 = require("./utils/tools");
const checktag_1 = tslib_1.__importDefault(require("./utils/checktag"));
const binaries_1 = require("./binaries");
const versions_1 = require("./utils/versions");
async function version() {
const v1 = await pkgVersion();
const v2 = await goplsVersion() || 'unknown';
coc_nvim_1.window.showMessage(`Version: coc-go ${v1}; gopls ${v2}`, 'more');
}
exports.version = version;
async function installGopls(client) {
await tools_1.installGoBin(binaries_1.GOPLS, true, goplsVersion);
if (client.needsStop()) {
await client.stop();
client.restart();
}
}
exports.installGopls = installGopls;
async function checkGopls(client, mode) {
const [current, latest] = await Promise.all([
goplsVersion(),
checktag_1.default("golang/tools", /^gopls\//),
]);
try {
let install = false;
switch (versions_1.compareVersions(latest, current)) {
case 0:
coc_nvim_1.window.showMessage(`[gopls] up-to-date: ${current}`, 'more');
break;
case 1:
switch (mode) {
case 'install':
install = true;
break;
case 'ask':
install = await coc_nvim_1.window.showPrompt(`[gopls] Install update? ${current} => ${latest}`);
break;
case 'inform':
coc_nvim_1.window.showMessage(`[gopls] update available: ${current} => ${latest}`);
break;
}
break;
case -1:
coc_nvim_1.window.showMessage(`[gopls] current: ${current} | latest: ${latest}`, 'more');
break;
}
if (install) {
await installGopls(client);
}
}
catch (e) {
coc_nvim_1.window.showMessage(e.toString(), 'error');
}
}
exports.checkGopls = checkGopls;
async function pkgVersion() {
try {
const pkgPath = path_1.default.resolve(__dirname, '..', 'package.json');
const pkgContent = await fs_1.default.promises.readFile(pkgPath, 'utf8');
return JSON.parse(pkgContent).version;
}
catch (err) {
console.error(err);
}
return '';
}
async function goplsVersion() {
const [, versionOut] = await tools_1.runGoTool("gopls", ["version"]);
const m = versionOut.trim().match(/\s{4}golang\.org\/x\/tools\/gopls@(v?\d+\.\d+\.\d+) .*/);
if (m && versions_1.isValidVersion(m[1])) {
return m[1].replace(/^v/, '');
}
return '';
}
async function installGomodifytags() {
await tools_1.installGoBin(binaries_1.GOMODIFYTAGS, true);
}
exports.installGomodifytags = installGomodifytags;
async function installGotests() {
await tools_1.installGoBin(binaries_1.GOTESTS, true);
}
exports.installGotests = installGotests;
async function installGoplay() {
await tools_1.installGoBin(binaries_1.GOPLAY, true);
}
exports.installGoplay = installGoplay;
async function installImpl() {
await tools_1.installGoBin(binaries_1.IMPL, true);
}
exports.installImpl = installImpl;
async function installTools() {
for (const tool of binaries_1.TOOLS) {
await tools_1.installGoBin(tool, true);
}
}
exports.installTools = installTools;
//# sourceMappingURL=commands.js.map

View file

@ -1,13 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.activeTextDocument = void 0;
const coc_nvim_1 = require("coc.nvim");
async function activeTextDocument() {
const doc = await coc_nvim_1.workspace.document;
if (doc.filetype != 'go') {
throw "Not a go document";
}
return doc.textDocument;
}
exports.activeTextDocument = activeTextDocument;
//# sourceMappingURL=editor.js.map

View file

@ -1,110 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.activate = void 0;
const coc_nvim_1 = require("coc.nvim");
const child_process_1 = require("child_process");
const tools_1 = require("./utils/tools");
const commands_1 = require("./commands");
const modify_tags_1 = require("./utils/modify-tags");
const config_1 = require("./utils/config");
const editor_1 = require("./editor");
const binaries_1 = require("./binaries");
const tests_1 = require("./utils/tests");
const playground_1 = require("./utils/playground");
const impl_1 = require("./utils/impl");
const restartConfigs = [
'go.goplsArgs',
'go.goplsOptions',
'go.goplsPath',
'go.goplsUseDaemon',
];
async function activate(context) {
config_1.setStoragePath(context.storagePath);
if (config_1.getConfig().enable === false) {
return;
}
registerGeneral(context);
registerGopls(context);
registerTest(context);
registerTags(context);
registerPlaygroud(context);
registerGoImpl(context);
registerTools(context);
}
exports.activate = activate;
async function registerGeneral(context) {
context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.version", () => commands_1.version()));
}
async function registerGopls(context) {
const config = config_1.getConfig();
const command = await goplsPath(config.goplsPath);
if (!command) {
return;
}
const args = config.goplsArgs ? [...config.goplsArgs] : [];
if (config.goplsUseDaemon !== false && !args.find(arg => arg.startsWith('-remote'))) {
// Use daemon by default
args.push('-remote=auto');
}
// TMPDIR needs to be resetted, because its altered by coc.nvim, which breaks
// the automatic deamon launching of gopls.
// See: https://github.com/neoclide/coc.nvim/commit/bdd9a9e1401fe6fdd57a9bd078e3651ecf1e0202
const tmpdir = await coc_nvim_1.workspace.nvim.eval('$TMPDIR');
const server = () => {
return new Promise(resolve => {
resolve(child_process_1.spawn(command, args, {
cwd: coc_nvim_1.workspace.cwd,
env: Object.assign(Object.assign(Object.assign({}, process.env), { TMPDIR: tmpdir }), config.goplsEnv),
}));
});
};
// https://github.com/neoclide/coc.nvim/blob/master/src/language-client/client.ts#L684
const clientOptions = {
documentSelector: ['go', 'gomod'],
initializationOptions: () => config_1.getConfig().goplsOptions,
disableWorkspaceFolders: config.disable.workspaceFolders,
disableDiagnostics: config.disable.diagnostics,
disableCompletion: config.disable.completion,
};
const client = new coc_nvim_1.LanguageClient('go', 'gopls', server, clientOptions);
if (config.checkForUpdates !== 'disabled' && !config.goplsPath) {
await commands_1.checkGopls(client, config.checkForUpdates);
}
context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client),
// restart gopls if options changed
coc_nvim_1.workspace.onDidChangeConfiguration(async (e) => {
if (restartConfigs.find(k => e.affectsConfiguration(k))) {
await client.stop();
client.restart();
}
}), coc_nvim_1.commands.registerCommand("go.install.gopls", () => commands_1.installGopls(client)));
}
async function goplsPath(goplsPath) {
if (goplsPath) {
if (!await tools_1.commandExists(goplsPath)) {
coc_nvim_1.window.showMessage(`goplsPath is configured ("${goplsPath}"), but does not exist!`, 'error');
return null;
}
return goplsPath;
}
if (!await tools_1.installGoBin(binaries_1.GOPLS)) {
return;
}
return tools_1.goBinPath(binaries_1.GOPLS);
}
async function registerGoImpl(context) {
context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.impl", () => commands_1.installImpl()), coc_nvim_1.commands.registerCommand("go.impl.cursor", async () => impl_1.generateImplStubs(await editor_1.activeTextDocument())));
}
async function registerTest(context) {
context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.gotests", () => commands_1.installGotests()), coc_nvim_1.commands.registerCommand("go.test.generate.file", async () => tests_1.generateTestsAll(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.test.generate.exported", async () => tests_1.generateTestsExported(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.test.generate.function", async () => tests_1.generateTestsFunction(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.test.toggle", async () => tests_1.toogleTests(await editor_1.activeTextDocument())));
}
async function registerTags(context) {
context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.gomodifytags", () => commands_1.installGomodifytags()), coc_nvim_1.commands.registerCommand("go.tags.add", async (...tags) => modify_tags_1.addTags(await editor_1.activeTextDocument(), { tags })), coc_nvim_1.commands.registerCommand("go.tags.add.line", async (...tags) => modify_tags_1.addTags(await editor_1.activeTextDocument(), { tags, selection: "line" })), coc_nvim_1.commands.registerCommand("go.tags.add.prompt", async () => modify_tags_1.addTags(await editor_1.activeTextDocument(), { prompt: true })), coc_nvim_1.commands.registerCommand("go.tags.remove", async (...tags) => modify_tags_1.removeTags(await editor_1.activeTextDocument(), { tags })), coc_nvim_1.commands.registerCommand("go.tags.remove.line", async (...tags) => modify_tags_1.removeTags(await editor_1.activeTextDocument(), { tags, selection: "line" })), coc_nvim_1.commands.registerCommand("go.tags.remove.prompt", async () => modify_tags_1.removeTags(await editor_1.activeTextDocument(), { prompt: true })), coc_nvim_1.commands.registerCommand("go.tags.clear", async () => modify_tags_1.clearTags(await editor_1.activeTextDocument())), coc_nvim_1.commands.registerCommand("go.tags.clear.line", async () => modify_tags_1.clearTags(await editor_1.activeTextDocument(), { selection: "line" })));
}
async function registerPlaygroud(context) {
context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.goplay", () => commands_1.installGoplay()), coc_nvim_1.commands.registerCommand("go.playground", async () => playground_1.openPlayground(await editor_1.activeTextDocument())));
}
async function registerTools(context) {
context.subscriptions.push(coc_nvim_1.commands.registerCommand("go.install.tools", () => commands_1.installTools()));
}
//# sourceMappingURL=extension.js.map

View file

@ -1,22 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
const releaseFilter = /^v\d+\.\d+\.\d+$/;
async function checkLatestTag(repo, prefixFilter) {
const resp = await node_fetch_1.default(`https://api.github.com/repos/${repo}/tags`);
const data = await resp.json();
let tags = data.map(t => t.name);
if (prefixFilter) {
tags = tags
.filter(t => t.match(prefixFilter))
.map(t => t.replace(prefixFilter, ''));
}
tags = tags
.filter(t => t.match(releaseFilter));
return tags.length > 0
? tags[0].replace(/^v/, '')
: '';
}
exports.default = checkLatestTag;
//# sourceMappingURL=checktag.js.map

View file

@ -1,27 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.configDir = exports.setStoragePath = exports.getConfig = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const os_1 = tslib_1.__importDefault(require("os"));
const coc_nvim_1 = require("coc.nvim");
const fs_1 = require("./fs");
const state = {};
function getConfig() {
return coc_nvim_1.workspace.getConfiguration().get("go");
}
exports.getConfig = getConfig;
function setStoragePath(dir) {
state.storagePath = dir;
}
exports.setStoragePath = setStoragePath;
async function configDir(...names) {
const storage = state.storagePath || path_1.default.join(os_1.default.homedir(), ".config", "coc", "go");
const dir = path_1.default.join(storage, ...names);
return new Promise((resolve) => {
fs_1.createDir(dir);
resolve(dir);
});
}
exports.configDir = configDir;
//# sourceMappingURL=config.js.map

View file

@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDir = void 0;
const tslib_1 = require("tslib");
const fs_1 = tslib_1.__importDefault(require("fs"));
const path_1 = tslib_1.__importDefault(require("path"));
function createDir(dirPath) {
if (fs_1.default.existsSync(dirPath)) {
return;
}
createDir(path_1.default.dirname(dirPath));
fs_1.default.mkdirSync(dirPath);
}
exports.createDir = createDir;
//# sourceMappingURL=fs.js.map

View file

@ -1,29 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const tmp_1 = tslib_1.__importDefault(require("tmp"));
const assert_1 = tslib_1.__importDefault(require("assert"));
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const fs_2 = require("./fs");
describe('createDir()', () => {
let tmpDir;
const joinPath = (...parts) => path_1.default.join(tmpDir.name, ...parts);
beforeEach(() => tmpDir = tmp_1.default.dirSync({ unsafeCleanup: true }));
afterEach(() => tmpDir.removeCallback());
it('should create a directory', () => {
const dirPath = joinPath('test');
fs_2.createDir(dirPath);
assert_1.default.ok(fs_1.default.existsSync(dirPath));
});
it('should create nested directories', () => {
const dirPath = joinPath('test', 'foo', 'bar');
fs_2.createDir(dirPath);
assert_1.default.ok(fs_1.default.existsSync(dirPath));
});
it('should not fail if directory exists', () => {
fs_2.createDir(tmpDir.name);
assert_1.default.ok(fs_1.default.existsSync(tmpDir.name));
});
});
//# sourceMappingURL=fs.test.js.map

View file

@ -1,43 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateImplStubs = void 0;
const coc_nvim_1 = require("coc.nvim");
const binaries_1 = require("../binaries");
const tools_1 = require("./tools");
const interfaceRegex = /^(\w+ \*?\w+ )?([\w./-]+)$/;
async function generateImplStubs(document) {
try {
const implInput = await coc_nvim_1.window.requestInput("Enter receiver and interface [f *File io.Closer]");
if (implInput == null) {
coc_nvim_1.window.showMessage("No input detected! Aborting.", "warning");
return;
}
const matches = implInput.match(interfaceRegex);
if (!matches) {
throw Error(`Cannot parse input: ${implInput}`);
}
const edit = await runGoImpl(document, [matches[1], matches[2]]);
await coc_nvim_1.workspace.applyEdit({ changes: { [document.uri]: [edit] } });
}
catch (error) {
coc_nvim_1.window.showMessage(error, "error");
}
}
exports.generateImplStubs = generateImplStubs;
async function runGoImpl(document, args) {
const stdout = await tools_1.execTool(binaries_1.IMPL, args);
const { line } = await coc_nvim_1.window.getCursorPosition();
const insertPos = { line: line + 1, character: 0 };
const lineText = await coc_nvim_1.workspace.getLine(document.uri, line);
const newText = lineText.trim() === ''
? stdout
: `\n${stdout}`;
return {
range: {
start: insertPos,
end: insertPos
},
newText
};
}
//# sourceMappingURL=impl.js.map

View file

@ -1,113 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.clearTags = exports.removeTags = exports.addTags = void 0;
const coc_nvim_1 = require("coc.nvim");
const vscode_uri_1 = require("vscode-uri");
const tools_1 = require("./tools");
const binaries_1 = require("../binaries");
////////////////////////////////////////////////////////////////////////////////
async function addTags(document, params = {}) {
const config = coc_nvim_1.workspace.getConfiguration().get('go.tags', {});
let tags = (params.tags && params.tags.length > 0)
? params.tags.join(',')
: (config.tags || 'json');
let options = (config.options || config.options === "")
? config.options
: 'json=omitempty';
const transform = (config.transform || "snakecase");
const skipUnexported = config.skipUnexported;
let cursor;
if (params.prompt) {
cursor = await coc_nvim_1.window.getCursorPosition();
tags = await coc_nvim_1.window.requestInput('Enter comma separated tag names', tags);
if (!tags) {
return;
}
options = await coc_nvim_1.window.requestInput('Enter comma separated options', options);
}
const args = [
'-add-tags', tags.replace(/ +/g, ''),
'-override',
'-add-options', (options || ""),
'-transform', transform,
...(await offsetArgs(document, (params.selection || "struct"), cursor))
];
if (skipUnexported) {
args.push('--skip-unexported');
}
await runGomodifytags(document, args);
}
exports.addTags = addTags;
async function removeTags(document, params = {}) {
const config = coc_nvim_1.workspace.getConfiguration().get('go.tags', {});
let tags = (params.tags && params.tags.length > 0)
? params.tags.join(',')
: (config.tags || 'json');
let cursor;
if (params.prompt) {
cursor = await coc_nvim_1.window.getCursorPosition();
tags = await coc_nvim_1.window.requestInput('Enter comma separated tag names', tags);
if (!tags) {
return;
}
}
await runGomodifytags(document, [
'-remove-tags', (tags || "json"),
'-clear-options',
...(await offsetArgs(document, (params.selection || "struct"), cursor))
]);
}
exports.removeTags = removeTags;
async function clearTags(document, params = {}) {
await runGomodifytags(document, [
'-clear-tags',
'-clear-options',
...(await offsetArgs(document, (params.selection || "struct")))
]);
}
exports.clearTags = clearTags;
////////////////////////////////////////////////////////////////////////////////
async function runGomodifytags(document, args) {
const fileName = vscode_uri_1.URI.parse(document.uri).fsPath;
args.push('-modified', '-file', fileName, '-format', 'json');
const input = fileArchive(fileName, document.getText());
const edit = await execGomodifytags(args, input);
await coc_nvim_1.workspace.applyEdit({ changes: { [document.uri]: [edit] } });
}
async function execGomodifytags(args, input) {
try {
const stdout = await tools_1.execTool(binaries_1.GOMODIFYTAGS, args, input);
const mods = JSON.parse(stdout);
return {
range: {
start: { line: mods.start - 1, character: 0 },
end: { line: mods.end, character: 0 }
},
newText: mods.lines.join("\n") + "\n"
};
}
catch (err) {
coc_nvim_1.window.showMessage(`Cannot modify tags: ${err}`, 'error');
throw err;
}
}
function fileArchive(fileName, fileContents) {
return fileName + '\n' + Buffer.byteLength(fileContents, 'utf8') + '\n' + fileContents;
}
// https://github.com/microsoft/vscode-go/blob/master/src/util.ts#L84
function byteOffsetAt(document, position) {
const offset = document.offsetAt(position);
const text = document.getText();
return Buffer.byteLength(text.substr(0, offset)).toString();
}
async function offsetArgs(document, selection, cursor = null) {
cursor = cursor || await coc_nvim_1.window.getCursorPosition();
coc_nvim_1.window.showMessage(`selection = ${selection}`);
switch (selection) {
case "struct":
return ['-offset', byteOffsetAt(document, cursor)];
case "line":
return ['-line', String(cursor.line + 1)];
}
}
//# sourceMappingURL=modify-tags.js.map

View file

@ -1,22 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.openPlayground = void 0;
const coc_nvim_1 = require("coc.nvim");
const tools_1 = require("./tools");
const binaries_1 = require("../binaries");
async function openPlayground(document) {
return runGoplay(document.getText());
}
exports.openPlayground = openPlayground;
async function runGoplay(code) {
try {
const stdout = await tools_1.execTool(binaries_1.GOPLAY, ['-'], code);
coc_nvim_1.window.showMessage(stdout);
return true;
}
catch (err) {
coc_nvim_1.window.showMessage(`${err}`, "error");
return false;
}
}
//# sourceMappingURL=playground.js.map

View file

@ -1,85 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractFunctionName = exports.toogleTests = exports.generateTestsFunction = exports.generateTestsExported = exports.generateTestsAll = void 0;
const coc_nvim_1 = require("coc.nvim");
const vscode_uri_1 = require("vscode-uri");
const tools_1 = require("./tools");
const binaries_1 = require("../binaries");
////////////////////////////////////////////////////////////////////////////////
async function generateTestsAll(document) {
if (isTest(document)) {
coc_nvim_1.window.showMessage("Document is a test file", "error");
return;
}
await runGotests(document, ["-all"]) && await openTests(document);
}
exports.generateTestsAll = generateTestsAll;
async function generateTestsExported(document) {
if (isTest(document)) {
coc_nvim_1.window.showMessage("Document is a test file", "error");
return;
}
await runGotests(document, ["-exported"]) && await openTests(document);
}
exports.generateTestsExported = generateTestsExported;
async function generateTestsFunction(document) {
if (isTest(document)) {
coc_nvim_1.window.showMessage("Document is a test file", "error");
return;
}
const { line } = await coc_nvim_1.window.getCursorPosition();
const text = await document.getText({
start: { line, character: 0 },
end: { line, character: Infinity },
});
coc_nvim_1.window.showMessage(text);
const funcName = extractFunctionName(text);
if (!funcName) {
coc_nvim_1.window.showMessage("No function found", "error");
return;
}
await runGotests(document, ["-only", `^${funcName}$`]) && await openTests(document);
}
exports.generateTestsFunction = generateTestsFunction;
async function toogleTests(document) {
const targetURI = isTest(document)
? sourceURI(document)
: testURI(document);
return coc_nvim_1.workspace.openResource(targetURI);
}
exports.toogleTests = toogleTests;
////////////////////////////////////////////////////////////////////////////////
async function openTests(document) {
return coc_nvim_1.workspace.openResource(testURI(document));
}
function isTest(document) {
return document.uri.endsWith('_test.go');
}
function testURI(document) {
return document.uri.replace(/(_test)?\.go$/, '_test.go');
}
function sourceURI(document) {
return document.uri.replace(/(_test)?\.go$/, '.go');
}
async function runGotests(document, args) {
const config = coc_nvim_1.workspace.getConfiguration().get('go.tests', {});
args.push(...(config.generateFlags || []), '-w', vscode_uri_1.URI.parse(document.uri).fsPath);
try {
const stdout = await tools_1.execTool(binaries_1.GOTESTS, args);
coc_nvim_1.window.showMessage(stdout || "");
return true;
}
catch (err) {
coc_nvim_1.window.showMessage(`Error: ${err}`, "error");
return false;
}
}
////////////////////////////////////////////////////////////////////////////////
function extractFunctionName(line) {
const m = /^func +(\([^)]+\) +)?([^\s(]+)/.exec(line);
if (m) {
return m[2];
}
}
exports.extractFunctionName = extractFunctionName;
//# sourceMappingURL=tests.js.map

View file

@ -1,21 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const tests_1 = require("./tests");
describe('extractFunctionName()', () => {
const cases = [
['', null],
['\tfuncFoo()', null],
['func Foo() {', 'Foo'],
['func Foo() string {', 'Foo'],
['func Foo(str string) string {', 'Foo'],
['func (b *Bar) Foo(str string) string {', 'Foo'],
];
cases.forEach(([line, name]) => {
it(`should extract ${JSON.stringify(name)} from "${line}"`, () => {
assert_1.default.equal(name, tests_1.extractFunctionName(line));
});
});
});
//# sourceMappingURL=tests.test.js.map

View file

@ -1,121 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.execTool = exports.commandExists = exports.runGoTool = exports.goBinPath = exports.installGoBin = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const util_1 = tslib_1.__importDefault(require("util"));
const child_process_1 = require("child_process");
const coc_nvim_1 = require("coc.nvim");
const which_1 = tslib_1.__importDefault(require("which"));
const config_1 = require("./config");
const runExec = util_1.default.promisify(child_process_1.exec);
const isWin = process.platform === 'win32';
async function installGoBin(source, force = false, getVersion) {
const name = goBinName(source);
if (!force && await goBinExists(name)) {
return true;
}
const statusItem = coc_nvim_1.window.createStatusBarItem(90, { progress: true });
statusItem.text = `Installing '${name}'`;
statusItem.show();
const success = await goRun(`get ${source}@latest`) && await goBinExists(name);
if (success) {
const vname = getVersion ? `${name}@${await getVersion()}` : name;
coc_nvim_1.window.showMessage(`Installed '${vname}'`);
}
else {
coc_nvim_1.window.showMessage(`Failed to install '${name}'`, 'error');
}
statusItem.hide();
return success;
}
exports.installGoBin = installGoBin;
async function goBinPath(source) {
const name = goBinName(source);
return path_1.default.join(await config_1.configDir('bin'), name + (isWin ? ".exe" : ""));
}
exports.goBinPath = goBinPath;
async function runGoTool(name, args = []) {
const bin = await goBinPath(name);
return new Promise((resolve) => {
const p = child_process_1.spawn(bin, args);
let out = "";
p.stdout.on('data', (data) => out += data);
p.on("close", code => resolve([code, out]));
});
}
exports.runGoTool = runGoTool;
async function commandExists(command) {
if (path_1.default.isAbsolute(command)) {
return fileExists(command);
}
return new Promise((resolve) => { which_1.default(command, (err) => resolve(err == null)); });
}
exports.commandExists = commandExists;
////////////////////////////////////////////////////////////////////////////////
async function goBinExists(source) {
const name = goBinName(source);
const bin = await goBinPath(name);
return fileExists(bin);
}
async function fileExists(path) {
return new Promise((resolve) => fs_1.default.open(path, 'r', (err) => resolve(err === null)));
}
async function goRun(args) {
const gopath = await config_1.configDir('tools');
const gobin = await config_1.configDir('bin');
const env = {
GO111MODULE: 'on',
GOBIN: gobin,
GOPATH: gopath,
GOROOT: '',
GOTOOLDIR: '',
};
const cmd = isWin
? `go ${args}`
: `env GOBIN=${gobin} go ${args}`;
const opts = {
env: Object.assign({}, process.env, env),
cwd: gopath,
shell: isWin ? undefined : process.env.SHELL,
windowsHide: true,
};
try {
await runExec(cmd, opts);
}
catch (ex) {
coc_nvim_1.window.showMessage(ex, 'error');
return false;
}
return true;
}
async function execTool(source, args, input) {
const [bin, name] = await Promise.all([
goBinPath(source),
goBinName(source),
]);
if (!await commandExists(bin)) {
await installGoBin(source);
}
return new Promise((resolve, reject) => {
const p = child_process_1.execFile(bin, args, { cwd: coc_nvim_1.workspace.cwd }, async (err, stdout, stderr) => {
if (err && err.code === "ENOENT") {
return reject(`Error: Command ${name} not found! Run "CocCommand go.install.${name}" to install it and try again.`);
}
if (err) {
return reject(stderr.toString());
}
return resolve(stdout.toString());
});
if (p.pid) {
p.stdin.end(input);
}
});
}
exports.execTool = execTool;
////////////////////////////////////////////////////////////////////////////////
function goBinName(source) {
return source.replace(/\/\.\.\.$/, '').split('/').pop();
}
//# sourceMappingURL=tools.js.map

View file

@ -1,33 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseVersion = exports.compareVersions = exports.isValidVersion = void 0;
const versionExp = /^v?(\d+)\.(\d+).(\d+)$/;
function isValidVersion(version) {
return Boolean(version.trim().match(versionExp));
}
exports.isValidVersion = isValidVersion;
function compareVersions(version1, version2) {
const v1 = parseVersion(version1);
const v2 = parseVersion(version2);
for (let i = 0; i < 3; i++) {
if (v1[i] !== v2[i]) {
return Math.max(-1, Math.min(1, v1[i] - v2[i]));
}
}
return 0;
}
exports.compareVersions = compareVersions;
function parseVersion(v) {
let ver = [0, 0, 0];
const match = v.trim().match(versionExp);
if (match) {
const [, major, minor, patch] = match;
ver = [parseInt(major), parseInt(minor), parseInt(patch)];
}
if (!isValidVersion(v)) {
throw new Error(`'${v}' is not a valid version`);
}
return ver;
}
exports.parseVersion = parseVersion;
//# sourceMappingURL=versions.js.map

View file

@ -1,58 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const versions_1 = require("./versions");
const v0 = [0, 0, 0];
const v1 = [1, 0, 0];
const v1_2 = [1, 2, 0];
const v1_2_3 = [1, 2, 3];
describe('isValidVersion()', () => {
it('should recognise valid versions', () => {
assert_1.default.ok(versions_1.isValidVersion('v1.0.0'));
assert_1.default.ok(versions_1.isValidVersion('1.0.0'));
assert_1.default.ok(versions_1.isValidVersion('0.1.0'));
assert_1.default.ok(versions_1.isValidVersion('0.0.1'));
assert_1.default.ok(versions_1.isValidVersion('0.0.0'));
assert_1.default.ok(versions_1.isValidVersion('v0.0.0'));
});
it('should recognise invalid versions', () => {
assert_1.default.ok(!versions_1.isValidVersion('v 1.0.0'));
assert_1.default.ok(!versions_1.isValidVersion('1'));
assert_1.default.ok(!versions_1.isValidVersion('1.1'));
});
});
describe("parseVersion()", () => {
it("should parse simple versions", () => {
assert_1.default.deepStrictEqual(versions_1.parseVersion('v0.0.0'), v0);
assert_1.default.deepStrictEqual(versions_1.parseVersion('v1.0.0'), v1);
assert_1.default.deepStrictEqual(versions_1.parseVersion('v1.2.0'), v1_2);
assert_1.default.deepStrictEqual(versions_1.parseVersion('v1.2.3'), v1_2_3);
});
});
describe('compareVersions()', () => {
it('should compare equal version', () => {
assert_1.default.throws(() => versions_1.compareVersions('', ''));
assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '1.0.0'), 0);
assert_1.default.strictEqual(versions_1.compareVersions('1.2.0', '1.2.0'), 0);
assert_1.default.strictEqual(versions_1.compareVersions('1.2.3', '1.2.3'), 0);
assert_1.default.strictEqual(versions_1.compareVersions('v1.0.0', '1.0.0'), 0);
});
it('should compare greater version', () => {
assert_1.default.throws(() => versions_1.compareVersions('', ''));
assert_1.default.strictEqual(versions_1.compareVersions('2.0.0', '1.0.0'), 1);
assert_1.default.strictEqual(versions_1.compareVersions('1.1.0', '1.0.0'), 1);
assert_1.default.strictEqual(versions_1.compareVersions('1.0.4', '1.0.0'), 1);
assert_1.default.strictEqual(versions_1.compareVersions('v1.1.0', '1.0.0'), 1);
assert_1.default.strictEqual(versions_1.compareVersions('1.1.0', 'v1.0.0'), 1);
});
it('should compare smaller version', () => {
assert_1.default.throws(() => versions_1.compareVersions('', ''));
assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '2.0.0'), -1);
assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '1.1.0'), -1);
assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', '1.0.4'), -1);
assert_1.default.strictEqual(versions_1.compareVersions('1.0.0', 'v1.1.0'), -1);
assert_1.default.strictEqual(versions_1.compareVersions('v1.0.0', '1.1.0'), -1);
});
});
//# sourceMappingURL=versions.test.js.map

View file

@ -1 +0,0 @@
../which/bin/node-which

View file

@ -1,50 +0,0 @@
{
"name": "coc-go",
"version": "0.13.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
},
"node_modules/node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
"engines": {
"node": "4.x || >=6.0.0"
}
},
"node_modules/tslib": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz",
"integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A=="
},
"node_modules/vscode-languageserver-textdocument": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz",
"integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA=="
},
"node_modules/vscode-uri": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.2.tgz",
"integrity": "sha512-jkjy6pjU1fxUvI51P+gCsxg1u2n8LSt0W6KrCNQceaziKzff74GoWmjVG46KieVzybO1sttPQmYfrwSHey7GUA=="
},
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
}
}
}

View file

@ -1,2 +0,0 @@
.nyc_output/
coverage/

View file

@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -1,51 +0,0 @@
# isexe
Minimal module to check if a file is executable, and a normal file.
Uses `fs.stat` and tests against the `PATHEXT` environment variable on
Windows.
## USAGE
```javascript
var isexe = require('isexe')
isexe('some-file-name', function (err, isExe) {
if (err) {
console.error('probably file does not exist or something', err)
} else if (isExe) {
console.error('this thing can be run')
} else {
console.error('cannot be run')
}
})
// same thing but synchronous, throws errors
var isExe = isexe.sync('some-file-name')
// treat errors as just "not executable"
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
```
## API
### `isexe(path, [options], [callback])`
Check if the path is executable. If no callback provided, and a
global `Promise` object is available, then a Promise will be returned.
Will raise whatever errors may be raised by `fs.stat`, unless
`options.ignoreErrors` is set to true.
### `isexe.sync(path, [options])`
Same as `isexe` but returns the value and throws any errors raised.
### Options
* `ignoreErrors` Treat all errors as "no, this is not executable", but
don't raise them.
* `uid` Number to use as the user id
* `gid` Number to use as the group id
* `pathExt` List of path extensions to use instead of `PATHEXT`
environment variable on Windows.

View file

@ -1,57 +0,0 @@
var fs = require('fs')
var core
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
core = require('./windows.js')
} else {
core = require('./mode.js')
}
module.exports = isexe
isexe.sync = sync
function isexe (path, options, cb) {
if (typeof options === 'function') {
cb = options
options = {}
}
if (!cb) {
if (typeof Promise !== 'function') {
throw new TypeError('callback not provided')
}
return new Promise(function (resolve, reject) {
isexe(path, options || {}, function (er, is) {
if (er) {
reject(er)
} else {
resolve(is)
}
})
})
}
core(path, options || {}, function (er, is) {
// ignore EACCES because that just means we aren't allowed to run it
if (er) {
if (er.code === 'EACCES' || options && options.ignoreErrors) {
er = null
is = false
}
}
cb(er, is)
})
}
function sync (path, options) {
// my kingdom for a filtered catch
try {
return core.sync(path, options || {})
} catch (er) {
if (options && options.ignoreErrors || er.code === 'EACCES') {
return false
} else {
throw er
}
}
}

View file

@ -1,41 +0,0 @@
module.exports = isexe
isexe.sync = sync
var fs = require('fs')
function isexe (path, options, cb) {
fs.stat(path, function (er, stat) {
cb(er, er ? false : checkStat(stat, options))
})
}
function sync (path, options) {
return checkStat(fs.statSync(path), options)
}
function checkStat (stat, options) {
return stat.isFile() && checkMode(stat, options)
}
function checkMode (stat, options) {
var mod = stat.mode
var uid = stat.uid
var gid = stat.gid
var myUid = options.uid !== undefined ?
options.uid : process.getuid && process.getuid()
var myGid = options.gid !== undefined ?
options.gid : process.getgid && process.getgid()
var u = parseInt('100', 8)
var g = parseInt('010', 8)
var o = parseInt('001', 8)
var ug = u | g
var ret = (mod & o) ||
(mod & g) && gid === myGid ||
(mod & u) && uid === myUid ||
(mod & ug) && myUid === 0
return ret
}

View file

@ -1,31 +0,0 @@
{
"name": "isexe",
"version": "2.0.0",
"description": "Minimal module to check if a file is executable.",
"main": "index.js",
"directories": {
"test": "test"
},
"devDependencies": {
"mkdirp": "^0.5.1",
"rimraf": "^2.5.0",
"tap": "^10.3.0"
},
"scripts": {
"test": "tap test/*.js --100",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
},
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "ISC",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/isexe.git"
},
"keywords": [],
"bugs": {
"url": "https://github.com/isaacs/isexe/issues"
},
"homepage": "https://github.com/isaacs/isexe#readme"
}

View file

@ -1,221 +0,0 @@
var t = require('tap')
var fs = require('fs')
var path = require('path')
var fixture = path.resolve(__dirname, 'fixtures')
var meow = fixture + '/meow.cat'
var mine = fixture + '/mine.cat'
var ours = fixture + '/ours.cat'
var fail = fixture + '/fail.false'
var noent = fixture + '/enoent.exe'
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var isWindows = process.platform === 'win32'
var hasAccess = typeof fs.access === 'function'
var winSkip = isWindows && 'windows'
var accessSkip = !hasAccess && 'no fs.access function'
var hasPromise = typeof Promise === 'function'
var promiseSkip = !hasPromise && 'no global Promise'
function reset () {
delete require.cache[require.resolve('../')]
return require('../')
}
t.test('setup fixtures', function (t) {
rimraf.sync(fixture)
mkdirp.sync(fixture)
fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n')
fs.chmodSync(meow, parseInt('0755', 8))
fs.writeFileSync(fail, '#!/usr/bin/env false\n')
fs.chmodSync(fail, parseInt('0644', 8))
fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n')
fs.chmodSync(mine, parseInt('0744', 8))
fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n')
fs.chmodSync(ours, parseInt('0754', 8))
t.end()
})
t.test('promise', { skip: promiseSkip }, function (t) {
var isexe = reset()
t.test('meow async', function (t) {
isexe(meow).then(function (is) {
t.ok(is)
t.end()
})
})
t.test('fail async', function (t) {
isexe(fail).then(function (is) {
t.notOk(is)
t.end()
})
})
t.test('noent async', function (t) {
isexe(noent).catch(function (er) {
t.ok(er)
t.end()
})
})
t.test('noent ignore async', function (t) {
isexe(noent, { ignoreErrors: true }).then(function (is) {
t.notOk(is)
t.end()
})
})
t.end()
})
t.test('no promise', function (t) {
global.Promise = null
var isexe = reset()
t.throws('try to meow a promise', function () {
isexe(meow)
})
t.end()
})
t.test('access', { skip: accessSkip || winSkip }, function (t) {
runTest(t)
})
t.test('mode', { skip: winSkip }, function (t) {
delete fs.access
delete fs.accessSync
var isexe = reset()
t.ok(isexe.sync(ours, { uid: 0, gid: 0 }))
t.ok(isexe.sync(mine, { uid: 0, gid: 0 }))
runTest(t)
})
t.test('windows', function (t) {
global.TESTING_WINDOWS = true
var pathExt = '.EXE;.CAT;.CMD;.COM'
t.test('pathExt option', function (t) {
runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' })
})
t.test('pathExt env', function (t) {
process.env.PATHEXT = pathExt
runTest(t)
})
t.test('no pathExt', function (t) {
// with a pathExt of '', any filename is fine.
// so the "fail" one would still pass.
runTest(t, { pathExt: '', skipFail: true })
})
t.test('pathext with empty entry', function (t) {
// with a pathExt of '', any filename is fine.
// so the "fail" one would still pass.
runTest(t, { pathExt: ';' + pathExt, skipFail: true })
})
t.end()
})
t.test('cleanup', function (t) {
rimraf.sync(fixture)
t.end()
})
function runTest (t, options) {
var isexe = reset()
var optionsIgnore = Object.create(options || {})
optionsIgnore.ignoreErrors = true
if (!options || !options.skipFail) {
t.notOk(isexe.sync(fail, options))
}
t.notOk(isexe.sync(noent, optionsIgnore))
if (!options) {
t.ok(isexe.sync(meow))
} else {
t.ok(isexe.sync(meow, options))
}
t.ok(isexe.sync(mine, options))
t.ok(isexe.sync(ours, options))
t.throws(function () {
isexe.sync(noent, options)
})
t.test('meow async', function (t) {
if (!options) {
isexe(meow, function (er, is) {
if (er) {
throw er
}
t.ok(is)
t.end()
})
} else {
isexe(meow, options, function (er, is) {
if (er) {
throw er
}
t.ok(is)
t.end()
})
}
})
t.test('mine async', function (t) {
isexe(mine, options, function (er, is) {
if (er) {
throw er
}
t.ok(is)
t.end()
})
})
t.test('ours async', function (t) {
isexe(ours, options, function (er, is) {
if (er) {
throw er
}
t.ok(is)
t.end()
})
})
if (!options || !options.skipFail) {
t.test('fail async', function (t) {
isexe(fail, options, function (er, is) {
if (er) {
throw er
}
t.notOk(is)
t.end()
})
})
}
t.test('noent async', function (t) {
isexe(noent, options, function (er, is) {
t.ok(er)
t.notOk(is)
t.end()
})
})
t.test('noent ignore async', function (t) {
isexe(noent, optionsIgnore, function (er, is) {
if (er) {
throw er
}
t.notOk(is)
t.end()
})
})
t.test('directory is not executable', function (t) {
isexe(__dirname, options, function (er, is) {
if (er) {
throw er
}
t.notOk(is)
t.end()
})
})
t.end()
}

View file

@ -1,42 +0,0 @@
module.exports = isexe
isexe.sync = sync
var fs = require('fs')
function checkPathExt (path, options) {
var pathext = options.pathExt !== undefined ?
options.pathExt : process.env.PATHEXT
if (!pathext) {
return true
}
pathext = pathext.split(';')
if (pathext.indexOf('') !== -1) {
return true
}
for (var i = 0; i < pathext.length; i++) {
var p = pathext[i].toLowerCase()
if (p && path.substr(-p.length).toLowerCase() === p) {
return true
}
}
return false
}
function checkStat (stat, path, options) {
if (!stat.isSymbolicLink() && !stat.isFile()) {
return false
}
return checkPathExt(path, options)
}
function isexe (path, options, cb) {
fs.stat(path, function (er, stat) {
cb(er, er ? false : checkStat(stat, path, options))
})
}
function sync (path, options) {
return checkStat(fs.statSync(path), path, options)
}

View file

@ -1,272 +0,0 @@
Changelog
=========
# 2.x release
## v2.6.1
**This is an important security release. It is strongly recommended to update as soon as possible.**
- Fix: honor the `size` option after following a redirect.
## v2.6.0
- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information.
- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body.
- Fix: `Response.url` should return empty string instead of `null` by default.
## v2.5.0
- Enhance: `Response` object now includes `redirected` property.
- Enhance: `fetch()` now accepts third-party `Blob` implementation as body.
- Other: disable `package-lock.json` generation as we never commit them.
- Other: dev dependency update.
- Other: readme update.
## v2.4.1
- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export.
## v2.4.0
- Enhance: added `Brotli` compression support (using node's zlib).
- Enhance: updated `Blob` implementation per spec.
- Fix: set content type automatically for `URLSearchParams`.
- Fix: `Headers` now reject empty header names.
- Fix: test cases, as node 12+ no longer accepts invalid header response.
## v2.3.0
- Enhance: added `AbortSignal` support, with README example.
- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`.
- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally.
## v2.2.1
- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header.
- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag.
- Other: Better README.
## v2.2.0
- Enhance: Support all `ArrayBuffer` view types
- Enhance: Support Web Workers
- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file
- Fix: Add `__esModule` property to the exports object
- Other: Better example in README for writing response to a file
- Other: More tests for Agent
## v2.1.2
- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects
- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size
- Fix: support custom `Host` headers with any casing
- Fix: support importing `fetch()` from TypeScript in `browser.js`
- Fix: handle the redirect response body properly
## v2.1.1
Fix packaging errors in v2.1.0.
## v2.1.0
- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request`
- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner
- Fix: silently ignore invalid HTTP headers
- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses
- Fix: include bodies when following a redirection when appropriate
## v2.0.0
This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2.
### General changes
- Major: Node.js 0.10.x and 0.12.x support is dropped
- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports
- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable
- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup)
- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings
- Other: rewrite in ES2015 using Babel
- Other: use Codecov for code coverage tracking
- Other: update package.json script for npm 5
- Other: `encoding` module is now optional (alpha.7)
- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9)
- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9)
### HTTP requests
- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec)
- Fix: errors in a response are caught before the body is accessed
- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+
### Response and Request classes
- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior
- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2)
- Major: internal methods are no longer exposed
- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec)
- Enhance: add `response.arrayBuffer()` (also applies to Requests)
- Enhance: add experimental `response.blob()` (also applies to Requests)
- Enhance: `URLSearchParams` is now accepted as a body
- Enhance: wrap `response.json()` json parsing error as `FetchError`
- Fix: fix Request and Response with `null` body
### Headers class
- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec)
- Enhance: make Headers iterable
- Enhance: make Headers constructor accept an array of tuples
- Enhance: make sure header names and values are valid in HTTP
- Fix: coerce Headers prototype function parameters to strings, where applicable
### Documentation
- Enhance: more comprehensive API docs
- Enhance: add a list of default headers in README
# 1.x release
## backport releases (v1.7.0 and beyond)
See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details.
## v1.6.3
- Enhance: error handling document to explain `FetchError` design
- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0)
## v1.6.2
- Enhance: minor document update
- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error
## v1.6.1
- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string
- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance
- Fix: documentation update
## v1.6.0
- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer
- Enhance: better old server support by handling raw deflate response
- Enhance: skip encoding detection for non-HTML/XML response
- Enhance: minor document update
- Fix: HEAD request doesn't need decompression, as body is empty
- Fix: `req.body` now accepts a Node.js buffer
## v1.5.3
- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate
- Fix: allow resolving response and cloned response in any order
- Fix: avoid setting `content-length` when `form-data` body use streams
- Fix: send DELETE request with content-length when body is present
- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch
## v1.5.2
- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent
## v1.5.1
- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection
## v1.5.0
- Enhance: rejected promise now use custom `Error` (thx to @pekeler)
- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler)
- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR)
## v1.4.1
- Fix: wrapping Request instance with FormData body again should preserve the body as-is
## v1.4.0
- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR)
- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin)
- Enhance: Body constructor has been refactored out (thx to @kirill-konshin)
- Enhance: Headers now has `forEach` method (thx to @tricoder42)
- Enhance: back to 100% code coverage
- Fix: better form-data support (thx to @item4)
- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR)
## v1.3.3
- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests
- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header
- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec
- Fix: `Request` and `Response` constructors now parse headers input using `Headers`
## v1.3.2
- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature)
## v1.3.1
- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side)
## v1.3.0
- Enhance: now `fetch.Request` is exposed as well
## v1.2.1
- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes
## v1.2.0
- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier
## v1.1.2
- Fix: `Headers` should only support `String` and `Array` properties, and ignore others
## v1.1.1
- Enhance: now req.headers accept both plain object and `Headers` instance
## v1.1.0
- Enhance: timeout now also applies to response body (in case of slow response)
- Fix: timeout is now cleared properly when fetch is done/has failed
## v1.0.6
- Fix: less greedy content-type charset matching
## v1.0.5
- Fix: when `follow = 0`, fetch should not follow redirect
- Enhance: update tests for better coverage
- Enhance: code formatting
- Enhance: clean up doc
## v1.0.4
- Enhance: test iojs support
- Enhance: timeout attached to socket event only fire once per redirect
## v1.0.3
- Fix: response size limit should reject large chunk
- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD)
## v1.0.2
- Fix: added res.ok per spec change
## v1.0.0
- Enhance: better test coverage and doc
# 0.x release
## v0.1
- Major: initial public release

View file

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2016 David Frank
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,590 +0,0 @@
node-fetch
==========
[![npm version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![coverage status][codecov-image]][codecov-url]
[![install size][install-size-image]][install-size-url]
[![Discord][discord-image]][discord-url]
A light-weight module that brings `window.fetch` to Node.js
(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567))
[![Backers][opencollective-image]][opencollective-url]
<!-- TOC -->
- [Motivation](#motivation)
- [Features](#features)
- [Difference from client-side fetch](#difference-from-client-side-fetch)
- [Installation](#installation)
- [Loading and configuring the module](#loading-and-configuring-the-module)
- [Common Usage](#common-usage)
- [Plain text or HTML](#plain-text-or-html)
- [JSON](#json)
- [Simple Post](#simple-post)
- [Post with JSON](#post-with-json)
- [Post with form parameters](#post-with-form-parameters)
- [Handling exceptions](#handling-exceptions)
- [Handling client and server errors](#handling-client-and-server-errors)
- [Advanced Usage](#advanced-usage)
- [Streams](#streams)
- [Buffer](#buffer)
- [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data)
- [Extract Set-Cookie Header](#extract-set-cookie-header)
- [Post data using a file stream](#post-data-using-a-file-stream)
- [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart)
- [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal)
- [API](#api)
- [fetch(url[, options])](#fetchurl-options)
- [Options](#options)
- [Class: Request](#class-request)
- [Class: Response](#class-response)
- [Class: Headers](#class-headers)
- [Interface: Body](#interface-body)
- [Class: FetchError](#class-fetcherror)
- [License](#license)
- [Acknowledgement](#acknowledgement)
<!-- /TOC -->
## Motivation
Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime.
See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side).
## Features
- Stay consistent with `window.fetch` API.
- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences.
- Use native promise but allow substituting it with [insert your favorite promise library].
- Use native Node streams for body on both request and response.
- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically.
- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting.
## Difference from client-side fetch
- See [Known Differences](LIMITS.md) for details.
- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue.
- Pull requests are welcomed too!
## Installation
Current stable release (`2.x`)
```sh
$ npm install node-fetch
```
## Loading and configuring the module
We suggest you load the module via `require` until the stabilization of ES modules in node:
```js
const fetch = require('node-fetch');
```
If you are using a Promise library other than native, set it through `fetch.Promise`:
```js
const Bluebird = require('bluebird');
fetch.Promise = Bluebird;
```
## Common Usage
NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences.
#### Plain text or HTML
```js
fetch('https://github.com/')
.then(res => res.text())
.then(body => console.log(body));
```
#### JSON
```js
fetch('https://api.github.com/users/github')
.then(res => res.json())
.then(json => console.log(json));
```
#### Simple Post
```js
fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' })
.then(res => res.json()) // expecting a json response
.then(json => console.log(json));
```
#### Post with JSON
```js
const body = { a: 1 };
fetch('https://httpbin.org/post', {
method: 'post',
body: JSON.stringify(body),
headers: { 'Content-Type': 'application/json' },
})
.then(res => res.json())
.then(json => console.log(json));
```
#### Post with form parameters
`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods.
NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such:
```js
const { URLSearchParams } = require('url');
const params = new URLSearchParams();
params.append('a', 1);
fetch('https://httpbin.org/post', { method: 'POST', body: params })
.then(res => res.json())
.then(json => console.log(json));
```
#### Handling exceptions
NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information.
Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details.
```js
fetch('https://domain.invalid/')
.catch(err => console.error(err));
```
#### Handling client and server errors
It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses:
```js
function checkStatus(res) {
if (res.ok) { // res.status >= 200 && res.status < 300
return res;
} else {
throw MyCustomError(res.statusText);
}
}
fetch('https://httpbin.org/status/400')
.then(checkStatus)
.then(res => console.log('will not get here...'))
```
## Advanced Usage
#### Streams
The "Node.js way" is to use streams when possible:
```js
fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
.then(res => {
const dest = fs.createWriteStream('./octocat.png');
res.body.pipe(dest);
});
```
#### Buffer
If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API)
```js
const fileType = require('file-type');
fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
.then(res => res.buffer())
.then(buffer => fileType(buffer))
.then(type => { /* ... */ });
```
#### Accessing Headers and other Meta data
```js
fetch('https://github.com/')
.then(res => {
console.log(res.ok);
console.log(res.status);
console.log(res.statusText);
console.log(res.headers.raw());
console.log(res.headers.get('content-type'));
});
```
#### Extract Set-Cookie Header
Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API.
```js
fetch(url).then(res => {
// returns an array of values, instead of a string of comma-separated values
console.log(res.headers.raw()['set-cookie']);
});
```
#### Post data using a file stream
```js
const { createReadStream } = require('fs');
const stream = createReadStream('input.txt');
fetch('https://httpbin.org/post', { method: 'POST', body: stream })
.then(res => res.json())
.then(json => console.log(json));
```
#### Post with form-data (detect multipart)
```js
const FormData = require('form-data');
const form = new FormData();
form.append('a', 1);
fetch('https://httpbin.org/post', { method: 'POST', body: form })
.then(res => res.json())
.then(json => console.log(json));
// OR, using custom headers
// NOTE: getHeaders() is non-standard API
const form = new FormData();
form.append('a', 1);
const options = {
method: 'POST',
body: form,
headers: form.getHeaders()
}
fetch('https://httpbin.org/post', options)
.then(res => res.json())
.then(json => console.log(json));
```
#### Request cancellation with AbortSignal
> NOTE: You may cancel streamed requests only on Node >= v8.0.0
You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller).
An example of timing out a request after 150ms could be achieved as the following:
```js
import AbortController from 'abort-controller';
const controller = new AbortController();
const timeout = setTimeout(
() => { controller.abort(); },
150,
);
fetch(url, { signal: controller.signal })
.then(res => res.json())
.then(
data => {
useData(data)
},
err => {
if (err.name === 'AbortError') {
// request was aborted
}
},
)
.finally(() => {
clearTimeout(timeout);
});
```
See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples.
## API
### fetch(url[, options])
- `url` A string representing the URL for fetching
- `options` [Options](#fetch-options) for the HTTP(S) request
- Returns: <code>Promise&lt;[Response](#class-response)&gt;</code>
Perform an HTTP(S) fetch.
`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`.
<a id="fetch-options"></a>
### Options
The default values are shown after each option key.
```js
{
// These properties are part of the Fetch Standard
method: 'GET',
headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below)
body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream
redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect
signal: null, // pass an instance of AbortSignal to optionally abort requests
// The following properties are node-fetch extensions
follow: 20, // maximum redirect count. 0 to not follow redirect
timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead.
compress: true, // support gzip/deflate content encoding. false to disable
size: 0, // maximum response body size in bytes. 0 to disable
agent: null // http(s).Agent instance or function that returns an instance (see below)
}
```
##### Default Headers
If no values are set, the following request headers will be sent automatically:
Header | Value
------------------- | --------------------------------------------------------
`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_
`Accept` | `*/*`
`Connection` | `close` _(when no `options.agent` is present)_
`Content-Length` | _(automatically calculated, if possible)_
`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_
`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)`
Note: when `body` is a `Stream`, `Content-Length` is not set automatically.
##### Custom Agent
The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following:
- Support self-signed certificate
- Use only IPv4 or IPv6
- Custom DNS Lookup
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
```js
const httpAgent = new http.Agent({
keepAlive: true
});
const httpsAgent = new https.Agent({
keepAlive: true
});
const options = {
agent: function (_parsedURL) {
if (_parsedURL.protocol == 'http:') {
return httpAgent;
} else {
return httpsAgent;
}
}
}
```
<a id="class-request"></a>
### Class: Request
An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface.
Due to the nature of Node.js, the following properties are not implemented at this moment:
- `type`
- `destination`
- `referrer`
- `referrerPolicy`
- `mode`
- `credentials`
- `cache`
- `integrity`
- `keepalive`
The following node-fetch extension properties are provided:
- `follow`
- `compress`
- `counter`
- `agent`
See [options](#fetch-options) for exact meaning of these extensions.
#### new Request(input[, options])
<small>*(spec-compliant)*</small>
- `input` A string representing a URL, or another `Request` (which will be cloned)
- `options` [Options][#fetch-options] for the HTTP(S) request
Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request).
In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object.
<a id="class-response"></a>
### Class: Response
An HTTP(S) response. This class implements the [Body](#iface-body) interface.
The following properties are not implemented in node-fetch at this moment:
- `Response.error()`
- `Response.redirect()`
- `type`
- `trailer`
#### new Response([body[, options]])
<small>*(spec-compliant)*</small>
- `body` A `String` or [`Readable` stream][node-readable]
- `options` A [`ResponseInit`][response-init] options dictionary
Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response).
Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly.
#### response.ok
<small>*(spec-compliant)*</small>
Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300.
#### response.redirected
<small>*(spec-compliant)*</small>
Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0.
<a id="class-headers"></a>
### Class: Headers
This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented.
#### new Headers([init])
<small>*(spec-compliant)*</small>
- `init` Optional argument to pre-fill the `Headers` object
Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object.
```js
// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class
const meta = {
'Content-Type': 'text/xml',
'Breaking-Bad': '<3'
};
const headers = new Headers(meta);
// The above is equivalent to
const meta = [
[ 'Content-Type', 'text/xml' ],
[ 'Breaking-Bad', '<3' ]
];
const headers = new Headers(meta);
// You can in fact use any iterable objects, like a Map or even another Headers
const meta = new Map();
meta.set('Content-Type', 'text/xml');
meta.set('Breaking-Bad', '<3');
const headers = new Headers(meta);
const copyOfHeaders = new Headers(headers);
```
<a id="iface-body"></a>
### Interface: Body
`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes.
The following methods are not yet implemented in node-fetch at this moment:
- `formData()`
#### body.body
<small>*(deviation from spec)*</small>
* Node.js [`Readable` stream][node-readable]
Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable].
#### body.bodyUsed
<small>*(spec-compliant)*</small>
* `Boolean`
A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again.
#### body.arrayBuffer()
#### body.blob()
#### body.json()
#### body.text()
<small>*(spec-compliant)*</small>
* Returns: <code>Promise</code>
Consume the body and return a promise that will resolve to one of these formats.
#### body.buffer()
<small>*(node-fetch extension)*</small>
* Returns: <code>Promise&lt;Buffer&gt;</code>
Consume the body and return a promise that will resolve to a Buffer.
#### body.textConverted()
<small>*(node-fetch extension)*</small>
* Returns: <code>Promise&lt;String&gt;</code>
Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible.
(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.)
<a id="class-fetcherror"></a>
### Class: FetchError
<small>*(node-fetch extension)*</small>
An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info.
<a id="class-aborterror"></a>
### Class: AbortError
<small>*(node-fetch extension)*</small>
An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info.
## Acknowledgement
Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference.
`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr).
## License
MIT
[npm-image]: https://flat.badgen.net/npm/v/node-fetch
[npm-url]: https://www.npmjs.com/package/node-fetch
[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch
[travis-url]: https://travis-ci.org/bitinn/node-fetch
[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square
[discord-url]: https://discord.gg/Zxbndcm
[opencollective-image]: https://opencollective.com/node-fetch/backers.svg
[opencollective-url]: https://opencollective.com/node-fetch
[whatwg-fetch]: https://fetch.spec.whatwg.org/
[response-init]: https://fetch.spec.whatwg.org/#responseinit
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md
[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md
[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md

View file

@ -1,25 +0,0 @@
"use strict";
// ref: https://github.com/tc39/proposal-global
var getGlobal = function () {
// the only reliable means to get the global object is
// `Function('return this')()`
// However, this causes CSP violations in Chrome apps.
if (typeof self !== 'undefined') { return self; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
throw new Error('unable to locate global object');
}
var global = getGlobal();
module.exports = exports = global.fetch;
// Needed for TypeScript and Webpack.
if (global.fetch) {
exports.default = global.fetch.bind(global);
}
exports.Headers = global.Headers;
exports.Request = global.Request;
exports.Response = global.Response;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,66 +0,0 @@
{
"name": "node-fetch",
"version": "2.6.1",
"description": "A light-weight module that brings window.fetch to node.js",
"main": "lib/index",
"browser": "./browser.js",
"module": "lib/index.mjs",
"files": [
"lib/index.js",
"lib/index.mjs",
"lib/index.es.js",
"browser.js"
],
"engines": {
"node": "4.x || >=6.0.0"
},
"scripts": {
"build": "cross-env BABEL_ENV=rollup rollup -c",
"prepare": "npm run build",
"test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js",
"report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
"coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json"
},
"repository": {
"type": "git",
"url": "https://github.com/bitinn/node-fetch.git"
},
"keywords": [
"fetch",
"http",
"promise"
],
"author": "David Frank",
"license": "MIT",
"bugs": {
"url": "https://github.com/bitinn/node-fetch/issues"
},
"homepage": "https://github.com/bitinn/node-fetch",
"devDependencies": {
"@ungap/url-search-params": "^0.1.2",
"abort-controller": "^1.1.0",
"abortcontroller-polyfill": "^1.3.0",
"babel-core": "^6.26.3",
"babel-plugin-istanbul": "^4.1.6",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.16.3",
"chai": "^3.5.0",
"chai-as-promised": "^7.1.1",
"chai-iterator": "^1.1.1",
"chai-string": "~1.3.0",
"codecov": "^3.3.0",
"cross-env": "^5.2.0",
"form-data": "^2.3.3",
"is-builtin-module": "^1.0.0",
"mocha": "^5.0.0",
"nyc": "11.9.0",
"parted": "^0.1.1",
"promise": "^8.0.3",
"resumer": "0.0.0",
"rollup": "^0.63.4",
"rollup-plugin-babel": "^3.0.7",
"string-to-arraybuffer": "^1.0.2",
"whatwg-url": "^5.0.0"
},
"dependencies": {}
}

View file

@ -1,15 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

View file

@ -1,12 +0,0 @@
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View file

@ -1,154 +0,0 @@
# tslib
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
This library is primarily used by the `--importHelpers` flag in TypeScript.
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
```ts
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
exports.x = {};
exports.y = __assign({}, exports.x);
```
will instead be emitted as something like the following:
```ts
var tslib_1 = require("tslib");
exports.x = {};
exports.y = tslib_1.__assign({}, exports.x);
```
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
# Installing
For the latest stable version, run:
## npm
```sh
# TypeScript 3.9.2 or later
npm install tslib
# TypeScript 3.8.4 or earlier
npm install tslib@^1
# TypeScript 2.3.2 or earlier
npm install tslib@1.6.1
```
## yarn
```sh
# TypeScript 3.9.2 or later
yarn add tslib
# TypeScript 3.8.4 or earlier
yarn add tslib@^1
# TypeScript 2.3.2 or earlier
yarn add tslib@1.6.1
```
## bower
```sh
# TypeScript 3.9.2 or later
bower install tslib
# TypeScript 3.8.4 or earlier
bower install tslib@^1
# TypeScript 2.3.2 or earlier
bower install tslib@1.6.1
```
## JSPM
```sh
# TypeScript 3.9.2 or later
jspm install tslib
# TypeScript 3.8.4 or earlier
jspm install tslib@^1
# TypeScript 2.3.2 or earlier
jspm install tslib@1.6.1
```
# Usage
Set the `importHelpers` compiler option on the command line:
```
tsc --importHelpers file.ts
```
or in your tsconfig.json:
```json
{
"compilerOptions": {
"importHelpers": true
}
}
```
#### For bower and JSPM users
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
```json
{
"compilerOptions": {
"module": "amd",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["bower_components/tslib/tslib.d.ts"]
}
}
}
```
For JSPM users:
```json
{
"compilerOptions": {
"module": "system",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
}
}
}
```
# Contribute
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
# Documentation
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
* [Programming handbook](http://www.typescriptlang.org/Handbook)
* [Homepage](http://www.typescriptlang.org/)

View file

@ -1,53 +0,0 @@
import tslib from '../tslib.js';
const {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
} = tslib;
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
};

View file

@ -1,3 +0,0 @@
{
"type": "module"
}

View file

@ -1,37 +0,0 @@
{
"name": "tslib",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "2.1.0",
"license": "0BSD",
"description": "Runtime library for TypeScript helper functions",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript",
"tslib",
"runtime"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/tslib.git"
},
"main": "tslib.js",
"module": "tslib.es6.js",
"jsnext:main": "tslib.es6.js",
"typings": "tslib.d.ts",
"sideEffects": false,
"exports": {
".": {
"module": "./tslib.es6.js",
"import": "./modules/index.js",
"default": "./tslib.js"
},
"./": "./"
}
}

View file

@ -1,40 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
export declare function __extends(d: Function, b: Function): void;
export declare function __assign(t: any, ...sources: any[]): any;
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
export declare function __param(paramIndex: number, decorator: Function): Function;
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
export declare function __generator(thisArg: any, body: Function): any;
export declare function __exportStar(m: any, o: any): void;
export declare function __values(o: any): any;
export declare function __read(o: any, n?: number): any[];
/** @deprecated since TypeScript 4.2 */
export declare function __spread(...args: any[][]): any[];
/** @deprecated since TypeScript 4.2 */
export declare function __spreadArrays(...args: any[][]): any[];
export declare function __spreadArray(to: any[], from: any[]): any[];
export declare function __await(v: any): any;
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
export declare function __asyncDelegator(o: any): any;
export declare function __asyncValues(o: any): any;
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
export declare function __importStar<T>(mod: T): T;
export declare function __importDefault<T>(mod: T): T | { default: T };
export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V;
export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V;
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;

View file

@ -1 +0,0 @@
<script src="tslib.es6.js"></script>

View file

@ -1,237 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
export function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}

View file

@ -1 +0,0 @@
<script src="tslib.js"></script>

View file

@ -1,304 +0,0 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, System, Reflect, Promise */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __spreadArray;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __createBinding;
(function (factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
}
else if (typeof module === "object" && typeof module.exports === "object") {
factory(createExporter(root, createExporter(module.exports)));
}
else {
factory(createExporter(root));
}
function createExporter(exports, previous) {
if (exports !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports, "__esModule", { value: true });
}
else {
exports.__esModule = true;
}
}
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
__extends = function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
__rest = function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate = function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param = function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
__metadata = function (metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter = function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar = function(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
};
__createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
__values = function (o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read = function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
/** @deprecated */
__spread = function () {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
};
/** @deprecated */
__spreadArrays = function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray = function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
__await = function (v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
};
__asyncGenerator = function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
__asyncDelegator = function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
};
__asyncValues = function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
__makeTemplateObject = function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
__importStar = function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
__importDefault = function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__classPrivateFieldGet = function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
};
__classPrivateFieldSet = function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
};
exporter("__extends", __extends);
exporter("__assign", __assign);
exporter("__rest", __rest);
exporter("__decorate", __decorate);
exporter("__param", __param);
exporter("__metadata", __metadata);
exporter("__awaiter", __awaiter);
exporter("__generator", __generator);
exporter("__exportStar", __exportStar);
exporter("__createBinding", __createBinding);
exporter("__values", __values);
exporter("__read", __read);
exporter("__spread", __spread);
exporter("__spreadArrays", __spreadArrays);
exporter("__spreadArray", __spreadArray);
exporter("__await", __await);
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
exporter("__makeTemplateObject", __makeTemplateObject);
exporter("__importStar", __importStar);
exporter("__importDefault", __importDefault);
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
});

View file

@ -1,11 +0,0 @@
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
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,18 +0,0 @@
# Text Document implementation for a LSP Node server
[![NPM Version](https://img.shields.io/npm/v/vscode-languageserver-textDocument.svg)](https://npmjs.org/package/vscode-languageserver-textDocument)
[![NPM Downloads](https://img.shields.io/npm/dm/vscode-languageserver-textDocument.svg)](https://npmjs.org/package/vscode-languageserver-textDocument)
Npm module containing a simple text document implementation for [Node.js](https://nodejs.org/) language server
Click [here](https://code.visualstudio.com/docs/extensions/example-language-server) for a detailed document on how
to implement language servers for [VSCode](https://code.visualstudio.com/).
## History
### 1.0.0
Initial version.
## License
[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt)

View file

@ -1,180 +0,0 @@
/**
* A tagging type for string properties that are actually URIs.
*/
export declare type DocumentUri = string;
/**
* Position in a text document expressed as zero-based line and character offset.
* The offsets are based on a UTF-16 string representation. So a string of the form
* `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
* is 1 and the character offset of b is 3 since `𐐀` is represented using two code
* units in UTF-16.
*
* Positions are line end character agnostic. So you can not specify a position that
* denotes `\r|\n` or `\n|` where `|` represents the character offset.
*/
export interface Position {
/**
* Line position in a document (zero-based).
* If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
* If a line number is negative, it defaults to 0.
*/
line: number;
/**
* Character offset on a line in a document (zero-based). Assuming that the line is
* represented as a string, the `character` value represents the gap between the
* `character` and `character + 1`.
*
* If the character value is greater than the line length it defaults back to the
* line length.
* If a line number is negative, it defaults to 0.
*/
character: number;
}
/**
* A range in a text document expressed as (zero-based) start and end positions.
*
* If you want to specify a range that contains a line including the line ending
* character(s) then use an end position denoting the start of the next line.
* For example:
* ```ts
* {
* start: { line: 5, character: 23 }
* end : { line 6, character : 0 }
* }
* ```
*/
export interface Range {
/**
* The range's start position
*/
start: Position;
/**
* The range's end position.
*/
end: Position;
}
/**
* A text edit applicable to a text document.
*/
export interface TextEdit {
/**
* The range of the text document to be manipulated. To insert
* text into a document create a range where start === end.
*/
range: Range;
/**
* The string to be inserted. For delete operations use an
* empty string.
*/
newText: string;
}
/**
* An event describing a change to a text document. If range and rangeLength are omitted
* the new text is considered to be the full content of the document.
*/
export declare type TextDocumentContentChangeEvent = {
/**
* The range of the document that changed.
*/
range: Range;
/**
* The optional length of the range that got replaced.
*
* @deprecated use range instead.
*/
rangeLength?: number;
/**
* The new text for the provided range.
*/
text: string;
} | {
/**
* The new text of the whole document.
*/
text: string;
};
/**
* A simple text document. Not to be implemented. The document keeps the content
* as string.
*/
export interface TextDocument {
/**
* The associated URI for this document. Most documents have the __file__-scheme, indicating that they
* represent files on disk. However, some documents may have other schemes indicating that they are not
* available on disk.
*
* @readonly
*/
readonly uri: DocumentUri;
/**
* The identifier of the language associated with this document.
*
* @readonly
*/
readonly languageId: string;
/**
* The version number of this document (it will increase after each
* change, including undo/redo).
*
* @readonly
*/
readonly version: number;
/**
* Get the text of this document. A substring can be retrieved by
* providing a range.
*
* @param range (optional) An range within the document to return.
* If no range is passed, the full content is returned.
* Invalid range positions are adjusted as described in [Position.line](#Position.line)
* and [Position.character](#Position.character).
* If the start range position is greater than the end range position,
* then the effect of getText is as if the two positions were swapped.
* @return The text of this document or a substring of the text if a
* range is provided.
*/
getText(range?: Range): string;
/**
* Converts a zero-based offset to a position.
*
* @param offset A zero-based offset.
* @return A valid [position](#Position).
*/
positionAt(offset: number): Position;
/**
* Converts the position to a zero-based offset.
* Invalid positions are adjusted as described in [Position.line](#Position.line)
* and [Position.character](#Position.character).
*
* @param position A position.
* @return A valid zero-based offset.
*/
offsetAt(position: Position): number;
/**
* The number of lines in this document.
*
* @readonly
*/
readonly lineCount: number;
}
export declare namespace TextDocument {
/**
* Creates a new text document.
*
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param version The document's initial version number.
* @param content The document's content.
*/
function create(uri: DocumentUri, languageId: string, version: number, content: string): TextDocument;
/**
* Updates a TextDocument by modifing its content.
*
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
* @param changes the changes to apply to the document.
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
*
*/
function update(document: TextDocument, changes: TextDocumentContentChangeEvent[], version: number): TextDocument;
function applyEdits(document: TextDocument, edits: TextEdit[]): string;
}

View file

@ -1,269 +0,0 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
'use strict';
var FullTextDocument = /** @class */ (function () {
function FullTextDocument(uri, languageId, version, content) {
this._uri = uri;
this._languageId = languageId;
this._version = version;
this._content = content;
this._lineOffsets = undefined;
}
Object.defineProperty(FullTextDocument.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "languageId", {
get: function () {
return this._languageId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "version", {
get: function () {
return this._version;
},
enumerable: true,
configurable: true
});
FullTextDocument.prototype.getText = function (range) {
if (range) {
var start = this.offsetAt(range.start);
var end = this.offsetAt(range.end);
return this._content.substring(start, end);
}
return this._content;
};
FullTextDocument.prototype.update = function (changes, version) {
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
var change = changes_1[_i];
if (FullTextDocument.isIncremental(change)) {
// makes sure start is before end
var range = getWellformedRange(change.range);
// update content
var startOffset = this.offsetAt(range.start);
var endOffset = this.offsetAt(range.end);
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
// update the offsets
var startLine = Math.max(range.start.line, 0);
var endLine = Math.max(range.end.line, 0);
var lineOffsets = this._lineOffsets;
var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
if (endLine - startLine === addedLineOffsets.length) {
for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
}
}
else {
if (addedLineOffsets.length < 10000) {
lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
}
else { // avoid too many arguments for splice
this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
}
}
var diff = change.text.length - (endOffset - startOffset);
if (diff !== 0) {
for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
lineOffsets[i] = lineOffsets[i] + diff;
}
}
}
else if (FullTextDocument.isFull(change)) {
this._content = change.text;
this._lineOffsets = undefined;
}
else {
throw new Error('Unknown change event received');
}
}
this._version = version;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === undefined) {
this._lineOffsets = computeLineOffsets(this._content, true);
}
return this._lineOffsets;
};
FullTextDocument.prototype.positionAt = function (offset) {
offset = Math.max(Math.min(offset, this._content.length), 0);
var lineOffsets = this.getLineOffsets();
var low = 0, high = lineOffsets.length;
if (high === 0) {
return { line: 0, character: offset };
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (lineOffsets[mid] > offset) {
high = mid;
}
else {
low = mid + 1;
}
}
// low is the least x for which the line offset is larger than the current offset
// or array.length if no line offset is larger than the current offset
var line = low - 1;
return { line: line, character: offset - lineOffsets[line] };
};
FullTextDocument.prototype.offsetAt = function (position) {
var lineOffsets = this.getLineOffsets();
if (position.line >= lineOffsets.length) {
return this._content.length;
}
else if (position.line < 0) {
return 0;
}
var lineOffset = lineOffsets[position.line];
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
};
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
get: function () {
return this.getLineOffsets().length;
},
enumerable: true,
configurable: true
});
FullTextDocument.isIncremental = function (event) {
var candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range !== undefined &&
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
};
FullTextDocument.isFull = function (event) {
var candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
};
return FullTextDocument;
}());
export var TextDocument;
(function (TextDocument) {
/**
* Creates a new text document.
*
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param version The document's initial version number.
* @param content The document's content.
*/
function create(uri, languageId, version, content) {
return new FullTextDocument(uri, languageId, version, content);
}
TextDocument.create = create;
/**
* Updates a TextDocument by modifing its content.
*
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
* @param changes the changes to apply to the document.
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
*
*/
function update(document, changes, version) {
if (document instanceof FullTextDocument) {
document.update(changes, version);
return document;
}
else {
throw new Error('TextDocument.update: document must be created by TextDocument.create');
}
}
TextDocument.update = update;
function applyEdits(document, edits) {
var text = document.getText();
var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {
var diff = a.range.start.line - b.range.start.line;
if (diff === 0) {
return a.range.start.character - b.range.start.character;
}
return diff;
});
var lastModifiedOffset = 0;
var spans = [];
for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
var e = sortedEdits_1[_i];
var startOffset = document.offsetAt(e.range.start);
if (startOffset < lastModifiedOffset) {
throw new Error('Overlapping edit');
}
else if (startOffset > lastModifiedOffset) {
spans.push(text.substring(lastModifiedOffset, startOffset));
}
if (e.newText.length) {
spans.push(e.newText);
}
lastModifiedOffset = document.offsetAt(e.range.end);
}
spans.push(text.substr(lastModifiedOffset));
return spans.join('');
}
TextDocument.applyEdits = applyEdits;
})(TextDocument || (TextDocument = {}));
function mergeSort(data, compare) {
if (data.length <= 1) {
// sorted
return data;
}
var p = (data.length / 2) | 0;
var left = data.slice(0, p);
var right = data.slice(p);
mergeSort(left, compare);
mergeSort(right, compare);
var leftIdx = 0;
var rightIdx = 0;
var i = 0;
while (leftIdx < left.length && rightIdx < right.length) {
var ret = compare(left[leftIdx], right[rightIdx]);
if (ret <= 0) {
// smaller_equal -> take left to preserve order
data[i++] = left[leftIdx++];
}
else {
// greater -> take right
data[i++] = right[rightIdx++];
}
}
while (leftIdx < left.length) {
data[i++] = left[leftIdx++];
}
while (rightIdx < right.length) {
data[i++] = right[rightIdx++];
}
return data;
}
function computeLineOffsets(text, isAtLineStart, textOffset) {
if (textOffset === void 0) { textOffset = 0; }
var result = isAtLineStart ? [textOffset] : [];
for (var i = 0; i < text.length; i++) {
var ch = text.charCodeAt(i);
if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {
if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
i++;
}
result.push(textOffset + i + 1);
}
}
return result;
}
function getWellformedRange(range) {
var start = range.start;
var end = range.end;
if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
return { start: end, end: start };
}
return range;
}
function getWellformedEdit(textEdit) {
var range = getWellformedRange(textEdit.range);
if (range !== textEdit.range) {
return { newText: textEdit.newText, range: range };
}
return textEdit;
}

View file

@ -1,403 +0,0 @@
{
"program": {
"fileInfos": {
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts": {
"version": "1f753cee573dea40df8a9dc873fef5566957b19ad513874f6643d8dfb14842d0",
"signature": "1f753cee573dea40df8a9dc873fef5566957b19ad513874f6643d8dfb14842d0"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts": {
"version": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96",
"signature": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts": {
"version": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1",
"signature": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts": {
"version": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743",
"signature": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts": {
"version": "2a0390a665763bcc90f0670e43c587928d8fefe2a94a11209c1e22cba7b09f52",
"signature": "2a0390a665763bcc90f0670e43c587928d8fefe2a94a11209c1e22cba7b09f52"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts": {
"version": "dd94d8ef48c562389eb58af8df3a3a34d11367f7c818192aa5f16470d469e3f0",
"signature": "dd94d8ef48c562389eb58af8df3a3a34d11367f7c818192aa5f16470d469e3f0"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts": {
"version": "828413486bdcaa342558e8e4570b1b287b776cb61b4b70b0214bd10c5d9a94c3",
"signature": "828413486bdcaa342558e8e4570b1b287b776cb61b4b70b0214bd10c5d9a94c3"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts": {
"version": "6c9f73334f8bf47aea685ca5b46a8f7e992a223e96fbceb030f26a4d2324ba21",
"signature": "6c9f73334f8bf47aea685ca5b46a8f7e992a223e96fbceb030f26a4d2324ba21"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts": {
"version": "e6b8ff2798f8ebd7a1c7afd8671f2cb67ee1901c422f5964d74b0b34c6574ea2",
"signature": "e6b8ff2798f8ebd7a1c7afd8671f2cb67ee1901c422f5964d74b0b34c6574ea2"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts": {
"version": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe",
"signature": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts": {
"version": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976",
"signature": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts": {
"version": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230",
"signature": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": {
"version": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303",
"signature": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts": {
"version": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0",
"signature": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts": {
"version": "ff8ad203e83338289b0f5defc1a5b5c253fb7d251b464db497383f915a0df3f4",
"signature": "ff8ad203e83338289b0f5defc1a5b5c253fb7d251b464db497383f915a0df3f4"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": {
"version": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f",
"signature": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts": {
"version": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c",
"signature": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts": {
"version": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6",
"signature": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": {
"version": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46",
"signature": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46"
},
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts": {
"version": "bf170fa7aee80f09f393a5350184a5bb6e2addb0410f6c9e023280d18c7472aa",
"signature": "21f9731fc2e8e009fdaef137a04546c27877314c748c6702fe9329518fb16538"
},
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts": {
"version": "9fecfa38d5d803f40f5e43b6d251678305cae462985305cbc2f2707ab32e7dfa",
"signature": "7514b3fa0996de70bba147262edffd3136aea07e654b60d50defbde16e4fca56"
},
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/edits.test.ts": {
"version": "51ba23f23c0999b2ab2cdcc688e8e5c02a991ea73040e843412b3b2148fc8535",
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"
},
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/textdocument.test.ts": {
"version": "6340b7c97c8d92c59eeececad5d086ad893eda125d2445ba6637bfaea6d9f05c",
"signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts": {
"version": "725d9be2fd48440256f4deb00649adffdbc5ecd282b09e89d4e200663792c34c",
"signature": "725d9be2fd48440256f4deb00649adffdbc5ecd282b09e89d4e200663792c34c"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts": {
"version": "751b8d5b85eee82bd38964a6ff43e89e61a586c64f653e3d1eb8fa7eb372ed30",
"signature": "751b8d5b85eee82bd38964a6ff43e89e61a586c64f653e3d1eb8fa7eb372ed30"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts": {
"version": "d93bdd7313bdc64d926cd1429bdb9a979037240e89995fddbc6817075bbfe502",
"signature": "d93bdd7313bdc64d926cd1429bdb9a979037240e89995fddbc6817075bbfe502"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts": {
"version": "7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed",
"signature": "7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts": {
"version": "f377ba987daec87eee5f3dcf798bca328f3c24a7da1ad5120382b3cbe222a501",
"signature": "f377ba987daec87eee5f3dcf798bca328f3c24a7da1ad5120382b3cbe222a501"
},
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts": {
"version": "1de0ff6200b92798a5aef43f57029c79dbf69932037dee1c007fdd2c562db258",
"signature": "1de0ff6200b92798a5aef43f57029c79dbf69932037dee1c007fdd2c562db258"
}
},
"options": {
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"target": 1,
"module": 5,
"sourceMap": false,
"declaration": true,
"stripInternal": true,
"lib": [
"lib.es2015.d.ts"
],
"outDir": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/lib/esm",
"incremental": true,
"tsBuildInfoFile": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/lib/tsconfig.esm.tsbuildInfo",
"rootDir": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src",
"configFilePath": "/home/aeschli/workspaces/vscode-languageserver-node/textDocument/tsconfig.esm.json"
},
"referencedMap": {
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/edits.test.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/textdocument.test.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts"
]
},
"exportedModulesMap": {
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
],
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts"
]
},
"semanticDiagnosticsPerFile": [
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es5.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.core.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.collection.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.generator.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.iterable.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.promise.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.proxy.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.reflect.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2016.array.include.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.object.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.string.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.intl.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/main.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/helper.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/edits.test.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/textDocument/src/test/textdocument.test.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/eslint-visitor-keys/index.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/json-schema/index.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/mocha/index.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/inspector.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/base.d.ts",
"/home/aeschli/workspaces/vscode-languageserver-node/node_modules/@types/node/ts3.2/index.d.ts"
]
},
"version": "3.5.3"
}

View file

@ -1,180 +0,0 @@
/**
* A tagging type for string properties that are actually URIs.
*/
export declare type DocumentUri = string;
/**
* Position in a text document expressed as zero-based line and character offset.
* The offsets are based on a UTF-16 string representation. So a string of the form
* `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀`
* is 1 and the character offset of b is 3 since `𐐀` is represented using two code
* units in UTF-16.
*
* Positions are line end character agnostic. So you can not specify a position that
* denotes `\r|\n` or `\n|` where `|` represents the character offset.
*/
export interface Position {
/**
* Line position in a document (zero-based).
* If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
* If a line number is negative, it defaults to 0.
*/
line: number;
/**
* Character offset on a line in a document (zero-based). Assuming that the line is
* represented as a string, the `character` value represents the gap between the
* `character` and `character + 1`.
*
* If the character value is greater than the line length it defaults back to the
* line length.
* If a line number is negative, it defaults to 0.
*/
character: number;
}
/**
* A range in a text document expressed as (zero-based) start and end positions.
*
* If you want to specify a range that contains a line including the line ending
* character(s) then use an end position denoting the start of the next line.
* For example:
* ```ts
* {
* start: { line: 5, character: 23 }
* end : { line 6, character : 0 }
* }
* ```
*/
export interface Range {
/**
* The range's start position
*/
start: Position;
/**
* The range's end position.
*/
end: Position;
}
/**
* A text edit applicable to a text document.
*/
export interface TextEdit {
/**
* The range of the text document to be manipulated. To insert
* text into a document create a range where start === end.
*/
range: Range;
/**
* The string to be inserted. For delete operations use an
* empty string.
*/
newText: string;
}
/**
* An event describing a change to a text document. If range and rangeLength are omitted
* the new text is considered to be the full content of the document.
*/
export declare type TextDocumentContentChangeEvent = {
/**
* The range of the document that changed.
*/
range: Range;
/**
* The optional length of the range that got replaced.
*
* @deprecated use range instead.
*/
rangeLength?: number;
/**
* The new text for the provided range.
*/
text: string;
} | {
/**
* The new text of the whole document.
*/
text: string;
};
/**
* A simple text document. Not to be implemented. The document keeps the content
* as string.
*/
export interface TextDocument {
/**
* The associated URI for this document. Most documents have the __file__-scheme, indicating that they
* represent files on disk. However, some documents may have other schemes indicating that they are not
* available on disk.
*
* @readonly
*/
readonly uri: DocumentUri;
/**
* The identifier of the language associated with this document.
*
* @readonly
*/
readonly languageId: string;
/**
* The version number of this document (it will increase after each
* change, including undo/redo).
*
* @readonly
*/
readonly version: number;
/**
* Get the text of this document. A substring can be retrieved by
* providing a range.
*
* @param range (optional) An range within the document to return.
* If no range is passed, the full content is returned.
* Invalid range positions are adjusted as described in [Position.line](#Position.line)
* and [Position.character](#Position.character).
* If the start range position is greater than the end range position,
* then the effect of getText is as if the two positions were swapped.
* @return The text of this document or a substring of the text if a
* range is provided.
*/
getText(range?: Range): string;
/**
* Converts a zero-based offset to a position.
*
* @param offset A zero-based offset.
* @return A valid [position](#Position).
*/
positionAt(offset: number): Position;
/**
* Converts the position to a zero-based offset.
* Invalid positions are adjusted as described in [Position.line](#Position.line)
* and [Position.character](#Position.character).
*
* @param position A position.
* @return A valid zero-based offset.
*/
offsetAt(position: Position): number;
/**
* The number of lines in this document.
*
* @readonly
*/
readonly lineCount: number;
}
export declare namespace TextDocument {
/**
* Creates a new text document.
*
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param version The document's initial version number.
* @param content The document's content.
*/
function create(uri: DocumentUri, languageId: string, version: number, content: string): TextDocument;
/**
* Updates a TextDocument by modifing its content.
*
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
* @param changes the changes to apply to the document.
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
*
*/
function update(document: TextDocument, changes: TextDocumentContentChangeEvent[], version: number): TextDocument;
function applyEdits(document: TextDocument, edits: TextEdit[]): string;
}

View file

@ -1,280 +0,0 @@
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
var FullTextDocument = /** @class */ (function () {
function FullTextDocument(uri, languageId, version, content) {
this._uri = uri;
this._languageId = languageId;
this._version = version;
this._content = content;
this._lineOffsets = undefined;
}
Object.defineProperty(FullTextDocument.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "languageId", {
get: function () {
return this._languageId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "version", {
get: function () {
return this._version;
},
enumerable: true,
configurable: true
});
FullTextDocument.prototype.getText = function (range) {
if (range) {
var start = this.offsetAt(range.start);
var end = this.offsetAt(range.end);
return this._content.substring(start, end);
}
return this._content;
};
FullTextDocument.prototype.update = function (changes, version) {
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
var change = changes_1[_i];
if (FullTextDocument.isIncremental(change)) {
// makes sure start is before end
var range = getWellformedRange(change.range);
// update content
var startOffset = this.offsetAt(range.start);
var endOffset = this.offsetAt(range.end);
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
// update the offsets
var startLine = Math.max(range.start.line, 0);
var endLine = Math.max(range.end.line, 0);
var lineOffsets = this._lineOffsets;
var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
if (endLine - startLine === addedLineOffsets.length) {
for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
}
}
else {
if (addedLineOffsets.length < 10000) {
lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
}
else { // avoid too many arguments for splice
this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
}
}
var diff = change.text.length - (endOffset - startOffset);
if (diff !== 0) {
for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
lineOffsets[i] = lineOffsets[i] + diff;
}
}
}
else if (FullTextDocument.isFull(change)) {
this._content = change.text;
this._lineOffsets = undefined;
}
else {
throw new Error('Unknown change event received');
}
}
this._version = version;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === undefined) {
this._lineOffsets = computeLineOffsets(this._content, true);
}
return this._lineOffsets;
};
FullTextDocument.prototype.positionAt = function (offset) {
offset = Math.max(Math.min(offset, this._content.length), 0);
var lineOffsets = this.getLineOffsets();
var low = 0, high = lineOffsets.length;
if (high === 0) {
return { line: 0, character: offset };
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (lineOffsets[mid] > offset) {
high = mid;
}
else {
low = mid + 1;
}
}
// low is the least x for which the line offset is larger than the current offset
// or array.length if no line offset is larger than the current offset
var line = low - 1;
return { line: line, character: offset - lineOffsets[line] };
};
FullTextDocument.prototype.offsetAt = function (position) {
var lineOffsets = this.getLineOffsets();
if (position.line >= lineOffsets.length) {
return this._content.length;
}
else if (position.line < 0) {
return 0;
}
var lineOffset = lineOffsets[position.line];
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
};
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
get: function () {
return this.getLineOffsets().length;
},
enumerable: true,
configurable: true
});
FullTextDocument.isIncremental = function (event) {
var candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range !== undefined &&
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
};
FullTextDocument.isFull = function (event) {
var candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
};
return FullTextDocument;
}());
var TextDocument;
(function (TextDocument) {
/**
* Creates a new text document.
*
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param version The document's initial version number.
* @param content The document's content.
*/
function create(uri, languageId, version, content) {
return new FullTextDocument(uri, languageId, version, content);
}
TextDocument.create = create;
/**
* Updates a TextDocument by modifing its content.
*
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
* @param changes the changes to apply to the document.
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
*
*/
function update(document, changes, version) {
if (document instanceof FullTextDocument) {
document.update(changes, version);
return document;
}
else {
throw new Error('TextDocument.update: document must be created by TextDocument.create');
}
}
TextDocument.update = update;
function applyEdits(document, edits) {
var text = document.getText();
var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {
var diff = a.range.start.line - b.range.start.line;
if (diff === 0) {
return a.range.start.character - b.range.start.character;
}
return diff;
});
var lastModifiedOffset = 0;
var spans = [];
for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
var e = sortedEdits_1[_i];
var startOffset = document.offsetAt(e.range.start);
if (startOffset < lastModifiedOffset) {
throw new Error('Overlapping edit');
}
else if (startOffset > lastModifiedOffset) {
spans.push(text.substring(lastModifiedOffset, startOffset));
}
if (e.newText.length) {
spans.push(e.newText);
}
lastModifiedOffset = document.offsetAt(e.range.end);
}
spans.push(text.substr(lastModifiedOffset));
return spans.join('');
}
TextDocument.applyEdits = applyEdits;
})(TextDocument = exports.TextDocument || (exports.TextDocument = {}));
function mergeSort(data, compare) {
if (data.length <= 1) {
// sorted
return data;
}
var p = (data.length / 2) | 0;
var left = data.slice(0, p);
var right = data.slice(p);
mergeSort(left, compare);
mergeSort(right, compare);
var leftIdx = 0;
var rightIdx = 0;
var i = 0;
while (leftIdx < left.length && rightIdx < right.length) {
var ret = compare(left[leftIdx], right[rightIdx]);
if (ret <= 0) {
// smaller_equal -> take left to preserve order
data[i++] = left[leftIdx++];
}
else {
// greater -> take right
data[i++] = right[rightIdx++];
}
}
while (leftIdx < left.length) {
data[i++] = left[leftIdx++];
}
while (rightIdx < right.length) {
data[i++] = right[rightIdx++];
}
return data;
}
function computeLineOffsets(text, isAtLineStart, textOffset) {
if (textOffset === void 0) { textOffset = 0; }
var result = isAtLineStart ? [textOffset] : [];
for (var i = 0; i < text.length; i++) {
var ch = text.charCodeAt(i);
if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {
if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
i++;
}
result.push(textOffset + i + 1);
}
}
return result;
}
function getWellformedRange(range) {
var start = range.start;
var end = range.end;
if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
return { start: end, end: start };
}
return range;
}
function getWellformedEdit(textEdit) {
var range = getWellformedRange(textEdit.range);
if (range !== textEdit.range) {
return { newText: textEdit.newText, range: range };
}
return textEdit;
}
});

View file

@ -1,28 +0,0 @@
{
"name": "vscode-languageserver-textdocument",
"description": "A simple text document implementation for Node LSP servers",
"version": "1.0.1",
"author": "Microsoft Corporation",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-languageserver-node.git",
"directory": "textDocument"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-languageserver-node/issues"
},
"main": "./lib/umd/main.js",
"typings": "./lib/umd/main",
"module": "./lib/esm/main.js",
"scripts": {
"prepublishOnly": "npm run clean && npm run compile-esm && npm run compile && npm run test",
"postpublish": "node ../build/npm/post-publish.js",
"compile": "node ../build/bin/tsc -b ./tsconfig.json",
"compile-esm": "node ../build/bin/tsc -b ./tsconfig.esm.json",
"clean": "node ../node_modules/rimraf/bin.js lib",
"watch": "node ../build/bin/tsc -b ./tsconfig.json -w",
"test": "node ../node_modules/mocha/bin/_mocha",
"preversion": "npm test"
}
}

View file

@ -1,18 +0,0 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"target": "es5",
"module": "es6",
"sourceMap": false,
"declaration": true,
"stripInternal": true,
"lib": [ "es2015" ],
"outDir": "lib/esm",
"incremental": true,
"tsBuildInfoFile":"./lib/tsconfig.esm.tsbuildInfo",
"rootDir": "src"
},
"include": [
"src"
]
}

View file

@ -1,9 +0,0 @@
The MIT License (MIT)
Copyright (c) Microsoft
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,67 +0,0 @@
## vscode-uri
[![Build Status](https://travis-ci.org/Microsoft/vscode-uri.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-uri)
This module contains the URI implementation that is used by VS Code and its extensions.
It has support for parsing a string into `scheme`, `authority`, `path`, `query`, and
`fragment` URI components as defined in: http://tools.ietf.org/html/rfc3986
```
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
| _____________________|__
/ \ / \
urn:example:animal:ferret:nose
```
## Usage
```js
import { URI } from 'vscode-uri'
// parse an URI from string
let uri = URI.parse('https://code.visualstudio.com/docs/extensions/overview#frag')
assert.ok(uri.scheme === 'https');
assert.ok(uri.authority === 'code.visualstudio.com');
assert.ok(uri.path === '/docs/extensions/overview');
assert.ok(uri.query === '');
assert.ok(uri.fragment === 'frag');
assert.ok(uri.toString() === 'https://code.visualstudio.com/docs/extensions/overview#frag')
// create an URI from a fs path
let uri = URI.file('/users/me/c#-projects/');
assert.ok(uri.scheme === 'file');
assert.ok(uri.authority === '');
assert.ok(uri.path === '/users/me/c#-projects/');
assert.ok(uri.query === '');
assert.ok(uri.fragment === '');
assert.ok(uri.toString() === 'file:///users/me/c%23-projects/')
```
## Usage: Util
This module also exports a `Utils` package which is an extension, not part of `vscode.Uri`, and useful for path-math. There is:
* `Utils.joinPath(URI, paths): URI`
* `Utils.resolvePath(URI, paths): URI`
* `Utils.dirname(URI): string`
* `Utils.basename(URI): string`
* `Utils.extname(URI): string`
All util use posix path-math as defined by the node.js path module.
## Contributing
The source of this module is taken straight from the [vscode](https://github.com/microsoft/vscode)-sources and because of that issues and pull request should be created in that repository. Thanks and Happy Coding!
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,415 +0,0 @@
/**
* An inlined enum containing useful character codes (to be used with String.charCodeAt).
* Please leave the const keyword such that it gets inlined when compiled to JavaScript!
*/
export declare const enum CharCode {
Null = 0,
/**
* The `\b` character.
*/
Backspace = 8,
/**
* The `\t` character.
*/
Tab = 9,
/**
* The `\n` character.
*/
LineFeed = 10,
/**
* The `\r` character.
*/
CarriageReturn = 13,
Space = 32,
/**
* The `!` character.
*/
ExclamationMark = 33,
/**
* The `"` character.
*/
DoubleQuote = 34,
/**
* The `#` character.
*/
Hash = 35,
/**
* The `$` character.
*/
DollarSign = 36,
/**
* The `%` character.
*/
PercentSign = 37,
/**
* The `&` character.
*/
Ampersand = 38,
/**
* The `'` character.
*/
SingleQuote = 39,
/**
* The `(` character.
*/
OpenParen = 40,
/**
* The `)` character.
*/
CloseParen = 41,
/**
* The `*` character.
*/
Asterisk = 42,
/**
* The `+` character.
*/
Plus = 43,
/**
* The `,` character.
*/
Comma = 44,
/**
* The `-` character.
*/
Dash = 45,
/**
* The `.` character.
*/
Period = 46,
/**
* The `/` character.
*/
Slash = 47,
Digit0 = 48,
Digit1 = 49,
Digit2 = 50,
Digit3 = 51,
Digit4 = 52,
Digit5 = 53,
Digit6 = 54,
Digit7 = 55,
Digit8 = 56,
Digit9 = 57,
/**
* The `:` character.
*/
Colon = 58,
/**
* The `;` character.
*/
Semicolon = 59,
/**
* The `<` character.
*/
LessThan = 60,
/**
* The `=` character.
*/
Equals = 61,
/**
* The `>` character.
*/
GreaterThan = 62,
/**
* The `?` character.
*/
QuestionMark = 63,
/**
* The `@` character.
*/
AtSign = 64,
A = 65,
B = 66,
C = 67,
D = 68,
E = 69,
F = 70,
G = 71,
H = 72,
I = 73,
J = 74,
K = 75,
L = 76,
M = 77,
N = 78,
O = 79,
P = 80,
Q = 81,
R = 82,
S = 83,
T = 84,
U = 85,
V = 86,
W = 87,
X = 88,
Y = 89,
Z = 90,
/**
* The `[` character.
*/
OpenSquareBracket = 91,
/**
* The `\` character.
*/
Backslash = 92,
/**
* The `]` character.
*/
CloseSquareBracket = 93,
/**
* The `^` character.
*/
Caret = 94,
/**
* The `_` character.
*/
Underline = 95,
/**
* The ``(`)`` character.
*/
BackTick = 96,
a = 97,
b = 98,
c = 99,
d = 100,
e = 101,
f = 102,
g = 103,
h = 104,
i = 105,
j = 106,
k = 107,
l = 108,
m = 109,
n = 110,
o = 111,
p = 112,
q = 113,
r = 114,
s = 115,
t = 116,
u = 117,
v = 118,
w = 119,
x = 120,
y = 121,
z = 122,
/**
* The `{` character.
*/
OpenCurlyBrace = 123,
/**
* The `|` character.
*/
Pipe = 124,
/**
* The `}` character.
*/
CloseCurlyBrace = 125,
/**
* The `~` character.
*/
Tilde = 126,
U_Combining_Grave_Accent = 768,
U_Combining_Acute_Accent = 769,
U_Combining_Circumflex_Accent = 770,
U_Combining_Tilde = 771,
U_Combining_Macron = 772,
U_Combining_Overline = 773,
U_Combining_Breve = 774,
U_Combining_Dot_Above = 775,
U_Combining_Diaeresis = 776,
U_Combining_Hook_Above = 777,
U_Combining_Ring_Above = 778,
U_Combining_Double_Acute_Accent = 779,
U_Combining_Caron = 780,
U_Combining_Vertical_Line_Above = 781,
U_Combining_Double_Vertical_Line_Above = 782,
U_Combining_Double_Grave_Accent = 783,
U_Combining_Candrabindu = 784,
U_Combining_Inverted_Breve = 785,
U_Combining_Turned_Comma_Above = 786,
U_Combining_Comma_Above = 787,
U_Combining_Reversed_Comma_Above = 788,
U_Combining_Comma_Above_Right = 789,
U_Combining_Grave_Accent_Below = 790,
U_Combining_Acute_Accent_Below = 791,
U_Combining_Left_Tack_Below = 792,
U_Combining_Right_Tack_Below = 793,
U_Combining_Left_Angle_Above = 794,
U_Combining_Horn = 795,
U_Combining_Left_Half_Ring_Below = 796,
U_Combining_Up_Tack_Below = 797,
U_Combining_Down_Tack_Below = 798,
U_Combining_Plus_Sign_Below = 799,
U_Combining_Minus_Sign_Below = 800,
U_Combining_Palatalized_Hook_Below = 801,
U_Combining_Retroflex_Hook_Below = 802,
U_Combining_Dot_Below = 803,
U_Combining_Diaeresis_Below = 804,
U_Combining_Ring_Below = 805,
U_Combining_Comma_Below = 806,
U_Combining_Cedilla = 807,
U_Combining_Ogonek = 808,
U_Combining_Vertical_Line_Below = 809,
U_Combining_Bridge_Below = 810,
U_Combining_Inverted_Double_Arch_Below = 811,
U_Combining_Caron_Below = 812,
U_Combining_Circumflex_Accent_Below = 813,
U_Combining_Breve_Below = 814,
U_Combining_Inverted_Breve_Below = 815,
U_Combining_Tilde_Below = 816,
U_Combining_Macron_Below = 817,
U_Combining_Low_Line = 818,
U_Combining_Double_Low_Line = 819,
U_Combining_Tilde_Overlay = 820,
U_Combining_Short_Stroke_Overlay = 821,
U_Combining_Long_Stroke_Overlay = 822,
U_Combining_Short_Solidus_Overlay = 823,
U_Combining_Long_Solidus_Overlay = 824,
U_Combining_Right_Half_Ring_Below = 825,
U_Combining_Inverted_Bridge_Below = 826,
U_Combining_Square_Below = 827,
U_Combining_Seagull_Below = 828,
U_Combining_X_Above = 829,
U_Combining_Vertical_Tilde = 830,
U_Combining_Double_Overline = 831,
U_Combining_Grave_Tone_Mark = 832,
U_Combining_Acute_Tone_Mark = 833,
U_Combining_Greek_Perispomeni = 834,
U_Combining_Greek_Koronis = 835,
U_Combining_Greek_Dialytika_Tonos = 836,
U_Combining_Greek_Ypogegrammeni = 837,
U_Combining_Bridge_Above = 838,
U_Combining_Equals_Sign_Below = 839,
U_Combining_Double_Vertical_Line_Below = 840,
U_Combining_Left_Angle_Below = 841,
U_Combining_Not_Tilde_Above = 842,
U_Combining_Homothetic_Above = 843,
U_Combining_Almost_Equal_To_Above = 844,
U_Combining_Left_Right_Arrow_Below = 845,
U_Combining_Upwards_Arrow_Below = 846,
U_Combining_Grapheme_Joiner = 847,
U_Combining_Right_Arrowhead_Above = 848,
U_Combining_Left_Half_Ring_Above = 849,
U_Combining_Fermata = 850,
U_Combining_X_Below = 851,
U_Combining_Left_Arrowhead_Below = 852,
U_Combining_Right_Arrowhead_Below = 853,
U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below = 854,
U_Combining_Right_Half_Ring_Above = 855,
U_Combining_Dot_Above_Right = 856,
U_Combining_Asterisk_Below = 857,
U_Combining_Double_Ring_Below = 858,
U_Combining_Zigzag_Above = 859,
U_Combining_Double_Breve_Below = 860,
U_Combining_Double_Breve = 861,
U_Combining_Double_Macron = 862,
U_Combining_Double_Macron_Below = 863,
U_Combining_Double_Tilde = 864,
U_Combining_Double_Inverted_Breve = 865,
U_Combining_Double_Rightwards_Arrow_Below = 866,
U_Combining_Latin_Small_Letter_A = 867,
U_Combining_Latin_Small_Letter_E = 868,
U_Combining_Latin_Small_Letter_I = 869,
U_Combining_Latin_Small_Letter_O = 870,
U_Combining_Latin_Small_Letter_U = 871,
U_Combining_Latin_Small_Letter_C = 872,
U_Combining_Latin_Small_Letter_D = 873,
U_Combining_Latin_Small_Letter_H = 874,
U_Combining_Latin_Small_Letter_M = 875,
U_Combining_Latin_Small_Letter_R = 876,
U_Combining_Latin_Small_Letter_T = 877,
U_Combining_Latin_Small_Letter_V = 878,
U_Combining_Latin_Small_Letter_X = 879,
/**
* Unicode Character 'LINE SEPARATOR' (U+2028)
* http://www.fileformat.info/info/unicode/char/2028/index.htm
*/
LINE_SEPARATOR = 8232,
/**
* Unicode Character 'PARAGRAPH SEPARATOR' (U+2029)
* http://www.fileformat.info/info/unicode/char/2029/index.htm
*/
PARAGRAPH_SEPARATOR = 8233,
/**
* Unicode Character 'NEXT LINE' (U+0085)
* http://www.fileformat.info/info/unicode/char/0085/index.htm
*/
NEXT_LINE = 133,
U_CIRCUMFLEX = 94,
U_GRAVE_ACCENT = 96,
U_DIAERESIS = 168,
U_MACRON = 175,
U_ACUTE_ACCENT = 180,
U_CEDILLA = 184,
U_MODIFIER_LETTER_LEFT_ARROWHEAD = 706,
U_MODIFIER_LETTER_RIGHT_ARROWHEAD = 707,
U_MODIFIER_LETTER_UP_ARROWHEAD = 708,
U_MODIFIER_LETTER_DOWN_ARROWHEAD = 709,
U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING = 722,
U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING = 723,
U_MODIFIER_LETTER_UP_TACK = 724,
U_MODIFIER_LETTER_DOWN_TACK = 725,
U_MODIFIER_LETTER_PLUS_SIGN = 726,
U_MODIFIER_LETTER_MINUS_SIGN = 727,
U_BREVE = 728,
U_DOT_ABOVE = 729,
U_RING_ABOVE = 730,
U_OGONEK = 731,
U_SMALL_TILDE = 732,
U_DOUBLE_ACUTE_ACCENT = 733,
U_MODIFIER_LETTER_RHOTIC_HOOK = 734,
U_MODIFIER_LETTER_CROSS_ACCENT = 735,
U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR = 741,
U_MODIFIER_LETTER_HIGH_TONE_BAR = 742,
U_MODIFIER_LETTER_MID_TONE_BAR = 743,
U_MODIFIER_LETTER_LOW_TONE_BAR = 744,
U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR = 745,
U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK = 746,
U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK = 747,
U_MODIFIER_LETTER_UNASPIRATED = 749,
U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD = 751,
U_MODIFIER_LETTER_LOW_UP_ARROWHEAD = 752,
U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD = 753,
U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD = 754,
U_MODIFIER_LETTER_LOW_RING = 755,
U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT = 756,
U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT = 757,
U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT = 758,
U_MODIFIER_LETTER_LOW_TILDE = 759,
U_MODIFIER_LETTER_RAISED_COLON = 760,
U_MODIFIER_LETTER_BEGIN_HIGH_TONE = 761,
U_MODIFIER_LETTER_END_HIGH_TONE = 762,
U_MODIFIER_LETTER_BEGIN_LOW_TONE = 763,
U_MODIFIER_LETTER_END_LOW_TONE = 764,
U_MODIFIER_LETTER_SHELF = 765,
U_MODIFIER_LETTER_OPEN_SHELF = 766,
U_MODIFIER_LETTER_LOW_LEFT_ARROW = 767,
U_GREEK_LOWER_NUMERAL_SIGN = 885,
U_GREEK_TONOS = 900,
U_GREEK_DIALYTIKA_TONOS = 901,
U_GREEK_KORONIS = 8125,
U_GREEK_PSILI = 8127,
U_GREEK_PERISPOMENI = 8128,
U_GREEK_DIALYTIKA_AND_PERISPOMENI = 8129,
U_GREEK_PSILI_AND_VARIA = 8141,
U_GREEK_PSILI_AND_OXIA = 8142,
U_GREEK_PSILI_AND_PERISPOMENI = 8143,
U_GREEK_DASIA_AND_VARIA = 8157,
U_GREEK_DASIA_AND_OXIA = 8158,
U_GREEK_DASIA_AND_PERISPOMENI = 8159,
U_GREEK_DIALYTIKA_AND_VARIA = 8173,
U_GREEK_DIALYTIKA_AND_OXIA = 8174,
U_GREEK_VARIA = 8175,
U_GREEK_OXIA = 8189,
U_GREEK_DASIA = 8190,
U_OVERLINE = 8254,
/**
* UTF-8 BOM
* Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF)
* http://www.fileformat.info/info/unicode/char/feff/index.htm
*/
UTF8_BOM = 65279
}

View file

@ -1,3 +0,0 @@
import { URI } from './uri';
import { Utils } from './utils';
export { URI, Utils };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
export declare let isWindows: boolean;

View file

@ -1,145 +0,0 @@
/**
* Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986.
* This class is a simple parser which creates the basic component parts
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation
* and encoding.
*
* ```txt
* foo://example.com:8042/over/there?name=ferret#nose
* \_/ \______________/\_________/ \_________/ \__/
* | | | | |
* scheme authority path query fragment
* | _____________________|__
* / \ / \
* urn:example:animal:ferret:nose
* ```
*/
export declare class URI implements UriComponents {
static isUri(thing: any): thing is URI;
/**
* scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'.
* The part before the first colon.
*/
readonly scheme: string;
/**
* authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'.
* The part between the first double slashes and the next slash.
*/
readonly authority: string;
/**
* path is the '/some/path' part of 'http://www.msft.com/some/path?query#fragment'.
*/
readonly path: string;
/**
* query is the 'query' part of 'http://www.msft.com/some/path?query#fragment'.
*/
readonly query: string;
/**
* fragment is the 'fragment' part of 'http://www.msft.com/some/path?query#fragment'.
*/
readonly fragment: string;
/**
* @internal
*/
protected constructor(scheme: string, authority?: string, path?: string, query?: string, fragment?: string, _strict?: boolean);
/**
* @internal
*/
protected constructor(components: UriComponents);
/**
* Returns a string representing the corresponding file system path of this URI.
* Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the
* platform specific path separator.
*
* * Will *not* validate the path for invalid characters and semantics.
* * Will *not* look at the scheme of this URI.
* * The result shall *not* be used for display purposes but for accessing a file on disk.
*
*
* The *difference* to `URI#path` is the use of the platform specific separator and the handling
* of UNC paths. See the below sample of a file-uri with an authority (UNC path).
*
* ```ts
const u = URI.parse('file://server/c$/folder/file.txt')
u.authority === 'server'
u.path === '/shares/c$/file.txt'
u.fsPath === '\\server\c$\folder\file.txt'
```
*
* Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path,
* namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working
* with URIs that represent files on disk (`file` scheme).
*/
get fsPath(): string;
with(change: {
scheme?: string;
authority?: string | null;
path?: string | null;
query?: string | null;
fragment?: string | null;
}): URI;
/**
* Creates a new URI from a string, e.g. `http://www.msft.com/some/path`,
* `file:///usr/home`, or `scheme:with/path`.
*
* @param value A string which represents an URI (see `URI#toString`).
*/
static parse(value: string, _strict?: boolean): URI;
/**
* Creates a new URI from a file system path, e.g. `c:\my\files`,
* `/usr/home`, or `\\server\share\some\path`.
*
* The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument
* as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as**
* `URI.parse('file://' + path)` because the path might contain characters that are
* interpreted (# and ?). See the following sample:
* ```ts
const good = URI.file('/coding/c#/project1');
good.scheme === 'file';
good.path === '/coding/c#/project1';
good.fragment === '';
const bad = URI.parse('file://' + '/coding/c#/project1');
bad.scheme === 'file';
bad.path === '/coding/c'; // path is now broken
bad.fragment === '/project1';
```
*
* @param path A file system path (see `URI#fsPath`)
*/
static file(path: string): URI;
static from(components: {
scheme: string;
authority?: string;
path?: string;
query?: string;
fragment?: string;
}): URI;
/**
* Creates a string representation for this URI. It's guaranteed that calling
* `URI.parse` with the result of this function creates an URI which is equal
* to this URI.
*
* * The result shall *not* be used for display purposes but for externalization or transport.
* * The result will be encoded using the percentage encoding and encoding happens mostly
* ignore the scheme-specific encoding rules.
*
* @param skipEncoding Do not encode the result, default is `false`
*/
toString(skipEncoding?: boolean): string;
toJSON(): UriComponents;
static revive(data: UriComponents | URI): URI;
static revive(data: UriComponents | URI | undefined): URI | undefined;
static revive(data: UriComponents | URI | null): URI | null;
static revive(data: UriComponents | URI | undefined | null): URI | undefined | null;
}
export interface UriComponents {
scheme: string;
authority: string;
path: string;
query: string;
fragment: string;
}
/**
* Compute `fsPath` for the given uri
*/
export declare function uriToFsPath(uri: URI, keepDriveLetterCasing: boolean): string;

View file

@ -1,58 +0,0 @@
import { URI } from './uri';
export declare namespace Utils {
/**
* Joins one or more input paths to the path of URI.
* '/' is used as the directory separation character.
*
* The resolved path will be normalized. That means:
* - all '..' and '.' segments are resolved.
* - multiple, sequential occurences of '/' are replaced by a single instance of '/'.
* - trailing separators are preserved.
*
* @param uri The input URI.
* @param paths The paths to be joined with the path of URI.
* @returns A URI with the joined path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.
*/
function joinPath(uri: URI, ...paths: string[]): URI;
/**
* Resolves one or more paths against the path of a URI.
* '/' is used as the directory separation character.
*
* The resolved path will be normalized. That means:
* - all '..' and '.' segments are resolved.
* - multiple, sequential occurences of '/' are replaced by a single instance of '/'.
* - trailing separators are removed.
*
* @param uri The input URI.
* @param paths The paths to resolve against the path of URI.
* @returns A URI with the resolved path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.
*/
function resolvePath(uri: URI, ...paths: string[]): URI;
/**
* Returns a URI where the path is the directory name of the input uri, similar to the Unix dirname command.
* In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.
* The orignal URI is returned if the URIs path is empty or does not contain any path segments.
*
* @param uri The input URI.
* @return The last segment of the URIs path.
*/
function dirname(uri: URI): URI;
/**
* Returns the last segment of the path of a URI, similar to the Unix basename command.
* In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.
* The empty string is returned if the URIs path is empty or does not contain any path segments.
*
* @param uri The input URI.
* @return The base name of the URIs path.
*/
function basename(uri: URI): string;
/**
* Returns the extension name of the path of a URI, similar to the Unix extname command.
* In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.
* The empty string is returned if the URIs path is empty or does not contain any path segments.
*
* @param uri The input URI.
* @return The extension name of the URIs path.
*/
function extname(uri: URI): string;
}

View file

@ -1,37 +0,0 @@
{
"name": "vscode-uri",
"author": "Microsoft",
"version": "3.0.2",
"description": "The URI implementation that is used by VS Code and its extensions",
"main": "./lib/umd/index.js",
"typings": "./lib/umd/index",
"module": "./lib/esm/index.js",
"sideEffects": false,
"scripts": {
"clean": "rimraf lib",
"pack-production": "webpack --mode=production",
"pack-dev": "webpack",
"prepublish": "npm run test && npm run clean && npm run pack-production",
"test": "tsc -p ./src && npm run pack-dev && mocha"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/vscode-uri.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/vscode-uri/issues"
},
"homepage": "https://github.com/microsoft/vscode-uri#readme",
"devDependencies": {
"@types/mocha": "^8.0.3",
"@types/node": "^10.12.21",
"mocha": "8.1.3",
"path-browserify": "^1.0.1",
"rimraf": "^3.0.2",
"ts-loader": "^8.0.13",
"typescript": "^4.0.3",
"webpack": "^5.11.1",
"webpack-cli": "^4.3.1"
}
}

View file

@ -1,166 +0,0 @@
# Changes
## 2.0.2
* Rename bin to `node-which`
## 2.0.1
* generate changelog and publish on version bump
* enforce 100% test coverage
* Promise interface
## 2.0.0
* Parallel tests, modern JavaScript, and drop support for node < 8
## 1.3.1
* update deps
* update travis
## v1.3.0
* Add nothrow option to which.sync
* update tap
## v1.2.14
* appveyor: drop node 5 and 0.x
* travis-ci: add node 6, drop 0.x
## v1.2.13
* test: Pass missing option to pass on windows
* update tap
* update isexe to 2.0.0
* neveragain.tech pledge request
## v1.2.12
* Removed unused require
## v1.2.11
* Prevent changelog script from being included in package
## v1.2.10
* Use env.PATH only, not env.Path
## v1.2.9
* fix for paths starting with ../
* Remove unused `is-absolute` module
## v1.2.8
* bullet items in changelog that contain (but don't start with) #
## v1.2.7
* strip 'update changelog' changelog entries out of changelog
## v1.2.6
* make the changelog bulleted
## v1.2.5
* make a changelog, and keep it up to date
* don't include tests in package
* Properly handle relative-path executables
* appveyor
* Attach error code to Not Found error
* Make tests pass on Windows
## v1.2.4
* Fix typo
## v1.2.3
* update isexe, fix regression in pathExt handling
## v1.2.2
* update deps, use isexe module, test windows
## v1.2.1
* Sometimes windows PATH entries are quoted
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
* doc cli
## v1.2.0
* Add support for opt.all and -as cli flags
* test the bin
* update travis
* Allow checking for multiple programs in bin/which
* tap 2
## v1.1.2
* travis
* Refactored and fixed undefined error on Windows
* Support strict mode
## v1.1.1
* test +g exes against secondary groups, if available
* Use windows exe semantics on cygwin & msys
* cwd should be first in path on win32, not last
* Handle lower-case 'env.Path' on Windows
* Update docs
* use single-quotes
## v1.1.0
* Add tests, depend on is-absolute
## v1.0.9
* which.js: root is allowed to execute files owned by anyone
## v1.0.8
* don't use graceful-fs
## v1.0.7
* add license to package.json
## v1.0.6
* isc license
## 1.0.5
* Awful typo
## 1.0.4
* Test for path absoluteness properly
* win: Allow '' as a pathext if cmd has a . in it
## 1.0.3
* Remove references to execPath
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
* Make `isExe()` always return true on Windows.
* MIT
## 1.0.2
* Only files can be exes
## 1.0.1
* Respect the PATHEXT env for win32 support
* should 0755 the bin
* binary
* guts
* package
* 1st

View file

@ -1,15 +0,0 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -1,54 +0,0 @@
# which
Like the unix `which` utility.
Finds the first instance of a specified executable in the PATH
environment variable. Does not cache the results, so `hash -r` is not
needed when the PATH changes.
## USAGE
```javascript
var which = require('which')
// async usage
which('node', function (er, resolvedPath) {
// er is returned if no "node" is found on the PATH
// if it is found, then the absolute path to the exec is returned
})
// or promise
which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... })
// sync usage
// throws if not found
var resolved = which.sync('node')
// if nothrow option is used, returns null if not found
resolved = which.sync('node', {nothrow: true})
// Pass options to override the PATH and PATHEXT environment vars.
which('node', { path: someOtherPath }, function (er, resolved) {
if (er)
throw er
console.log('found at %j', resolved)
})
```
## CLI USAGE
Same as the BSD `which(1)` binary.
```
usage: which [-as] program ...
```
## OPTIONS
You may pass an options object as the second argument.
- `path`: Use instead of the `PATH` environment variable.
- `pathExt`: Use instead of the `PATHEXT` environment variable.
- `all`: Return all matches, instead of just the first one. Note that
this means the function returns an array of strings instead of a
single string.

View file

@ -1,52 +0,0 @@
#!/usr/bin/env node
var which = require("../")
if (process.argv.length < 3)
usage()
function usage () {
console.error('usage: which [-as] program ...')
process.exit(1)
}
var all = false
var silent = false
var dashdash = false
var args = process.argv.slice(2).filter(function (arg) {
if (dashdash || !/^-/.test(arg))
return true
if (arg === '--') {
dashdash = true
return false
}
var flags = arg.substr(1).split('')
for (var f = 0; f < flags.length; f++) {
var flag = flags[f]
switch (flag) {
case 's':
silent = true
break
case 'a':
all = true
break
default:
console.error('which: illegal option -- ' + flag)
usage()
}
}
return false
})
process.exit(args.reduce(function (pv, current) {
try {
var f = which.sync(current, { all: all })
if (all)
f = f.join('\n')
if (!silent)
console.log(f)
return pv;
} catch (e) {
return 1;
}
}, 0))

View file

@ -1,43 +0,0 @@
{
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"name": "which",
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
"version": "2.0.2",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-which.git"
},
"main": "which.js",
"bin": {
"node-which": "./bin/node-which"
},
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
},
"devDependencies": {
"mkdirp": "^0.5.0",
"rimraf": "^2.6.2",
"tap": "^14.6.9"
},
"scripts": {
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublish": "npm run changelog",
"prechangelog": "bash gen-changelog.sh",
"changelog": "git add CHANGELOG.md",
"postchangelog": "git commit -m 'update changelog - '${npm_package_version}",
"postpublish": "git push origin --follow-tags"
},
"files": [
"which.js",
"bin/node-which"
],
"tap": {
"check-coverage": true
},
"engines": {
"node": ">= 8"
}
}

View file

@ -1,125 +0,0 @@
const isWindows = process.platform === 'win32' ||
process.env.OSTYPE === 'cygwin' ||
process.env.OSTYPE === 'msys'
const path = require('path')
const COLON = isWindows ? ';' : ':'
const isexe = require('isexe')
const getNotFoundError = (cmd) =>
Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
const getPathInfo = (cmd, opt) => {
const colon = opt.colon || COLON
// If it has a slash, then we don't bother searching the pathenv.
// just check the file itself, and that's it.
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
: (
[
// windows always checks the cwd first
...(isWindows ? [process.cwd()] : []),
...(opt.path || process.env.PATH ||
/* istanbul ignore next: very unusual */ '').split(colon),
]
)
const pathExtExe = isWindows
? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
: ''
const pathExt = isWindows ? pathExtExe.split(colon) : ['']
if (isWindows) {
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
pathExt.unshift('')
}
return {
pathEnv,
pathExt,
pathExtExe,
}
}
const which = (cmd, opt, cb) => {
if (typeof opt === 'function') {
cb = opt
opt = {}
}
if (!opt)
opt = {}
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
const found = []
const step = i => new Promise((resolve, reject) => {
if (i === pathEnv.length)
return opt.all && found.length ? resolve(found)
: reject(getNotFoundError(cmd))
const ppRaw = pathEnv[i]
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
const pCmd = path.join(pathPart, cmd)
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
: pCmd
resolve(subStep(p, i, 0))
})
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
if (ii === pathExt.length)
return resolve(step(i + 1))
const ext = pathExt[ii]
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
if (!er && is) {
if (opt.all)
found.push(p + ext)
else
return resolve(p + ext)
}
return resolve(subStep(p, i, ii + 1))
})
})
return cb ? step(0).then(res => cb(null, res), cb) : step(0)
}
const whichSync = (cmd, opt) => {
opt = opt || {}
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
const found = []
for (let i = 0; i < pathEnv.length; i ++) {
const ppRaw = pathEnv[i]
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
const pCmd = path.join(pathPart, cmd)
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
: pCmd
for (let j = 0; j < pathExt.length; j ++) {
const cur = p + pathExt[j]
try {
const is = isexe.sync(cur, { pathExt: pathExtExe })
if (is) {
if (opt.all)
found.push(cur)
else
return cur
}
} catch (ex) {}
}
}
if (opt.all && found.length)
return found
if (opt.nothrow)
return null
throw getNotFoundError(cmd)
}
module.exports = which
which.sync = whichSync

File diff suppressed because it is too large Load diff

View file

@ -1,733 +0,0 @@
{
"name": "coc-go",
"version": "0.13.3",
"description": "gopls extension for coc",
"author": "Josa Gesell <josa@gesell.me>",
"license": "MIT",
"main": "lib/extension.js",
"repository": {
"type": "git",
"url": "https://github.com/josa42/coc-go.git"
},
"engines": {
"coc": "^0.0.80",
"node": ">=10"
},
"keywords": [
"coc.nvim",
"languageserver",
"gopls",
"go",
"golang",
"vim",
"neovim"
],
"scripts": {
"test": "true || mocha --require ts-node/register '**/*.test.ts'",
"test:watch": "mocha --watch --watch-files '**/*.ts' --require ts-node/register '**/*.test.ts'",
"clean": "rimraf lib",
"build": "tsc -p tsconfig.json",
"build:watch": "tsc --watch -p tsconfig.json",
"prepare": "yarn clean && yarn build",
"link:add": "node ./scripts/link.js add",
"link:remove": "node ./scripts/link.js remove",
"update": "yarn run update:snippets && yarn run update:options && yarn run update:readme && yarn run update:readme",
"update:snippets": "./scripts/update-snippets.js",
"update:options": "./scripts/update-options.sh && node ./scripts/update-options-interface.js",
"update:commands": "./scripts/update-commands.js",
"update:readme": "./scripts/update-tables.sh",
"lint": "eslint . --ext .ts,.js",
"link": "coc-dev link",
"unlink": "coc-dev unlink"
},
"activationEvents": [
"onLanguage:go",
"onLanguage:gomod",
"onCommand:go.install.gomodifytags",
"onCommand:go.install.goplay",
"onCommand:go.install.gopls",
"onCommand:go.install.gotests",
"onCommand:go.install.impl",
"onCommand:go.install.tools",
"onCommand:go.version"
],
"contributes": {
"rootPatterns": [
{
"filetype": "go",
"patterns": [
"go.mod"
]
},
{
"filetype": "gomod",
"patterns": [
"go.mod"
]
}
],
"configuration": {
"type": "object",
"title": "gols",
"properties": {
"go.enable": {
"type": "boolean",
"default": true,
"description": "Enable Go extension"
},
"go.trace.server": {
"type": "string",
"default": "off",
"enum": [
"off",
"messages",
"verbose"
],
"description": "Trace level of gopls"
},
"go.goplsPath": {
"type": "string",
"description": "Path to `gopls` bin (Change requires `:CocRestart`)"
},
"go.goplsArgs": {
"type": "array",
"items": {
"type": "string"
},
"description": "Arguments passed to `gopls` (Change requires `:CocRestart`)"
},
"go.goplsEnv": {
"type": "object",
"patternProperties": {
"^.+$": {
"type": "string"
}
},
"description": "ENV passed to `gopls` (Change requires `:CocRestart`)"
},
"go.goplsUseDaemon": {
"type": "boolean",
"default": true,
"description": "Run gopls as daemon"
},
"go.disable": {
"type": "object",
"description": "Disable gopls features",
"default": {},
"properties": {
"workspaceFolders": {
"type": "boolean",
"default": false,
"description": "Disable workspaceFolders feature (Change requires `:CocRestart`)"
},
"diagnostics": {
"type": "boolean",
"default": false,
"description": "Disable handle diagnostics (Change requires `:CocRestart`)"
},
"completion": {
"type": "boolean",
"default": false,
"description": "Disable completion feature (Change requires `:CocRestart`)"
}
}
},
"go.goplsOptions": {
"type": "object",
"description": "See `gopls` documentation: https://github.com/golang/tools/blob/master/gopls/doc/settings.md",
"properties": {
"allowImplicitNetworkAccess": {
"type": "boolean",
"default": false,
"description": "**This setting is experimental and may be deleted.**\n\nallowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module\ndownloads rather than requiring user action. This option will eventually\nbe removed.\n"
},
"allowModfileModifications": {
"type": "boolean",
"default": false,
"description": "**This setting is experimental and may be deleted.**\n\nallowModfileModifications disables -mod=readonly, allowing imports from\nout-of-scope modules. This option will eventually be removed.\n"
},
"analyses": {
"type": "object",
"description": "analyses specify analyses that the user would like to enable or disable.\nA map of the names of analysis passes that should be enabled/disabled.\nA full list of analyzers that gopls uses can be found\n[here](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).\n\nExample Usage:\n\n```json5\n...\n\"analyses\": {\n \"unreachable\": false, // Disable the unreachable analyzer.\n \"unusedparams\": true // Enable the unusedparams analyzer.\n}\n...\n```\n",
"additionalProperties": false,
"patternProperties": {
"^S[AT]?\\d{4}$": {
"type": "boolean"
}
},
"properties": {
"asmdecl": {
"type": "boolean",
"description": "report mismatches between assembly files and Go declarations",
"default": true
},
"assign": {
"type": "boolean",
"description": "check for useless assignments\nThis checker reports assignments of the form x = x or a[i] = a[i].\nThese are almost always useless, and even when they aren't they are\nusually a mistake.",
"default": true
},
"atomic": {
"type": "boolean",
"description": "check for common mistakes using the sync/atomic package\nThe atomic checker looks for assignment statements of the form:\n\tx = atomic.AddUint64(&x, 1)\nwhich are not atomic.",
"default": true
},
"atomicalign": {
"type": "boolean",
"description": "check for non-64-bits-aligned arguments to sync/atomic functions",
"default": true
},
"bools": {
"type": "boolean",
"description": "check for common mistakes involving boolean operators",
"default": true
},
"buildtag": {
"type": "boolean",
"description": "check that +build tags are well-formed and correctly located",
"default": true
},
"cgocall": {
"type": "boolean",
"description": "detect some violations of the cgo pointer passing rules\nCheck for invalid cgo pointer passing.\nThis looks for code that uses cgo to call C code passing values\nwhose types are almost always invalid according to the cgo pointer\nsharing rules.\nSpecifically, it warns about attempts to pass a Go chan, map, func,\nor slice to C, either directly, or via a pointer, array, or struct.",
"default": true
},
"composites": {
"type": "boolean",
"description": "check for unkeyed composite literals\nThis analyzer reports a diagnostic for composite literals of struct\ntypes imported from another package that do not use the field-keyed\nsyntax. Such literals are fragile because the addition of a new field\n(even if unexported) to the struct will cause compilation to fail.\nAs an example,\n\terr = &net.DNSConfigError{err}\nshould be replaced by:\n\terr = &net.DNSConfigError{Err: err}",
"default": true
},
"copylocks": {
"type": "boolean",
"description": "check for locks erroneously passed by value\nInadvertently copying a value containing a lock, such as sync.Mutex or\nsync.WaitGroup, may cause both copies to malfunction. Generally such\nvalues should be referred to through a pointer.",
"default": true
},
"deepequalerrors": {
"type": "boolean",
"description": "check for calls of reflect.DeepEqual on error values\nThe deepequalerrors checker looks for calls of the form:\n reflect.DeepEqual(err1, err2)\nwhere err1 and err2 are errors. Using reflect.DeepEqual to compare\nerrors is discouraged.",
"default": true
},
"errorsas": {
"type": "boolean",
"description": "report passing non-pointer or non-error values to errors.As\nThe errorsas analysis reports calls to errors.As where the type\nof the second argument is not a pointer to a type implementing error.",
"default": true
},
"fieldalignment": {
"type": "boolean",
"description": "find structs that would take less memory if their fields were sorted\nThis analyzer find structs that can be rearranged to take less memory, and provides\na suggested edit with the optimal order.\n**Disabled by default. Enable it by setting `\"analyses\": {\"fieldalignment\": true}`.**"
},
"httpresponse": {
"type": "boolean",
"description": "check for mistakes using HTTP responses\nA common mistake when using the net/http package is to defer a function\ncall to close the http.Response Body before checking the error that\ndetermines whether the response is valid:\n\tresp, err := http.Head(url)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// (defer statement belongs here)\nThis checker helps uncover latent nil dereference bugs by reporting a\ndiagnostic for such mistakes.",
"default": true
},
"ifaceassert": {
"type": "boolean",
"description": "detect impossible interface-to-interface type assertions\nThis checker flags type assertions v.(T) and corresponding type-switch cases\nin which the static type V of v is an interface that cannot possibly implement\nthe target interface T. This occurs when V and T contain methods with the same\nname but different signatures. Example:\n\tvar v interface {\n\t\tRead()\n\t}\n\t_ = v.(io.Reader)\nThe Read method in v has a different signature than the Read method in\nio.Reader, so this assertion cannot succeed.",
"default": true
},
"loopclosure": {
"type": "boolean",
"description": "check references to loop variables from within nested functions\nThis analyzer checks for references to loop variables from within a\nfunction literal inside the loop body. It checks only instances where\nthe function literal is called in a defer or go statement that is the\nlast statement in the loop body, as otherwise we would need whole\nprogram analysis.\nFor example:\n\tfor i, v := range s {\n\t\tgo func() {\n\t\t\tprintln(i, v) // not what you might expect\n\t\t}()\n\t}\nSee: https://golang.org/doc/go_faq.html#closures_and_goroutines",
"default": true
},
"lostcancel": {
"type": "boolean",
"description": "check cancel func returned by context.WithCancel is called\nThe cancellation function returned by context.WithCancel, WithTimeout,\nand WithDeadline must be called or the new context will remain live\nuntil its parent context is cancelled.\n(The background context is never cancelled.)",
"default": true
},
"nilfunc": {
"type": "boolean",
"description": "check for useless comparisons between functions and nil\nA useless comparison is one like f == nil as opposed to f() == nil.",
"default": true
},
"printf": {
"type": "boolean",
"description": "check consistency of Printf format strings and arguments\nThe check applies to known functions (for example, those in package fmt)\nas well as any detected wrappers of known functions.\nA function that wants to avail itself of printf checking but is not\nfound by this analyzer's heuristics (for example, due to use of\ndynamic calls) can insert a bogus call:\n\tif false {\n\t\t_ = fmt.Sprintf(format, args...) // enable printf checking\n\t}\nThe -funcs flag specifies a comma-separated list of names of additional\nknown formatting functions or methods. If the name contains a period,\nit must denote a specific function using one of the following forms:\n\tdir/pkg.Function\n\tdir/pkg.Type.Method\n\t(*dir/pkg.Type).Method\nOtherwise the name is interpreted as a case-insensitive unqualified\nidentifier such as \"errorf\". Either way, if a listed name ends in f, the\nfunction is assumed to be Printf-like, taking a format string before the\nargument list. Otherwise it is assumed to be Print-like, taking a list\nof arguments with no format string.",
"default": true
},
"shadow": {
"type": "boolean",
"description": "check for possible unintended shadowing of variables\nThis analyzer check for shadowed variables.\nA shadowed variable is a variable declared in an inner scope\nwith the same name and type as a variable in an outer scope,\nand where the outer variable is mentioned after the inner one\nis declared.\n(This definition can be refined; the module generates too many\nfalse positives and is not yet enabled by default.)\nFor example:\n\tfunc BadRead(f *os.File, buf []byte) error {\n\t\tvar err error\n\t\tfor {\n\t\t\tn, err := f.Read(buf) // shadows the function variable 'err'\n\t\t\tif err != nil {\n\t\t\t\tbreak // causes return of wrong value\n\t\t\t}\n\t\t\tfoo(buf)\n\t\t}\n\t\treturn err\n\t}\n**Disabled by default. Enable it by setting `\"analyses\": {\"shadow\": true}`.**"
},
"shift": {
"type": "boolean",
"description": "check for shifts that equal or exceed the width of the integer",
"default": true
},
"simplifycompositelit": {
"type": "boolean",
"description": "check for composite literal simplifications\nAn array, slice, or map composite literal of the form:\n\t[]T{T{}, T{}}\nwill be simplified to:\n\t[]T{{}, {}}\nThis is one of the simplifications that \"gofmt -s\" applies.",
"default": true
},
"simplifyrange": {
"type": "boolean",
"description": "check for range statement simplifications\nA range of the form:\n\tfor x, _ = range v {...}\nwill be simplified to:\n\tfor x = range v {...}\nA range of the form:\n\tfor _ = range v {...}\nwill be simplified to:\n\tfor range v {...}\nThis is one of the simplifications that \"gofmt -s\" applies.",
"default": true
},
"simplifyslice": {
"type": "boolean",
"description": "check for slice simplifications\nA slice expression of the form:\n\ts[a:len(s)]\nwill be simplified to:\n\ts[a:]\nThis is one of the simplifications that \"gofmt -s\" applies.",
"default": true
},
"sortslice": {
"type": "boolean",
"description": "check the argument type of sort.Slice\nsort.Slice requires an argument of a slice type. Check that\nthe interface{} value passed to sort.Slice is actually a slice.",
"default": true
},
"stdmethods": {
"type": "boolean",
"description": "check signature of methods of well-known interfaces\nSometimes a type may be intended to satisfy an interface but may fail to\ndo so because of a mistake in its method signature.\nFor example, the result of this WriteTo method should be (int64, error),\nnot error, to satisfy io.WriterTo:\n\ttype myWriterTo struct{...}\n func (myWriterTo) WriteTo(w io.Writer) error { ... }\nThis check ensures that each method whose name matches one of several\nwell-known interface methods from the standard library has the correct\nsignature for that interface.\nChecked method names include:\n\tFormat GobEncode GobDecode MarshalJSON MarshalXML\n\tPeek ReadByte ReadFrom ReadRune Scan Seek\n\tUnmarshalJSON UnreadByte UnreadRune WriteByte\n\tWriteTo",
"default": true
},
"stringintconv": {
"type": "boolean",
"description": "check for string(int) conversions\nThis checker flags conversions of the form string(x) where x is an integer\n(but not byte or rune) type. Such conversions are discouraged because they\nreturn the UTF-8 representation of the Unicode code point x, and not a decimal\nstring representation of x as one might expect. Furthermore, if x denotes an\ninvalid code point, the conversion cannot be statically rejected.\nFor conversions that intend on using the code point, consider replacing them\nwith string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the\nstring representation of the value in the desired base.",
"default": true
},
"structtag": {
"type": "boolean",
"description": "check that struct field tags conform to reflect.StructTag.Get\nAlso report certain struct tags (json, xml) used with unexported fields.",
"default": true
},
"testinggoroutine": {
"type": "boolean",
"description": "report calls to (*testing.T).Fatal from goroutines started by a test.\nFunctions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and\nSkip{,f,Now} methods of *testing.T, must be called from the test goroutine itself.\nThis checker detects calls to these functions that occur within a goroutine\nstarted by the test. For example:\nfunc TestFoo(t *testing.T) {\n go func() {\n t.Fatal(\"oops\") // error: (*T).Fatal called from non-test goroutine\n }()\n}",
"default": true
},
"tests": {
"type": "boolean",
"description": "check for common mistaken usages of tests and examples\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
"default": true
},
"unmarshal": {
"type": "boolean",
"description": "report passing non-pointer or non-interface values to unmarshal\nThe unmarshal analysis reports calls to functions such as json.Unmarshal\nin which the argument type is not a pointer or an interface.",
"default": true
},
"unreachable": {
"type": "boolean",
"description": "check for unreachable code\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by an return statement, a call to panic, an\ninfinite loop, or similar constructs.",
"default": true
},
"unsafeptr": {
"type": "boolean",
"description": "check for invalid conversions of uintptr to unsafe.Pointer\nThe unsafeptr analyzer reports likely incorrect uses of unsafe.Pointer\nto convert integers to pointers. A conversion from uintptr to\nunsafe.Pointer is invalid if it implies that there is a uintptr-typed\nword in memory that holds a pointer value, because that word will be\ninvisible to stack copying and to the garbage collector.",
"default": true
},
"unusedparams": {
"type": "boolean",
"description": "check for unused parameters of functions\nThe unusedparams analyzer checks functions to see if there are\nany parameters that are not being used.\nTo reduce false positives it ignores:\n- methods\n- parameters that do not have a name or are underscored\n- functions in test files\n- functions with empty bodies or those with just a return stmt\n**Disabled by default. Enable it by setting `\"analyses\": {\"unusedparams\": true}`.**"
},
"unusedresult": {
"type": "boolean",
"description": "check for unused results of calls to some functions\nSome functions like fmt.Errorf return a result and have no side effects,\nso it is always a mistake to discard the result. This analyzer reports\ncalls to certain functions in which the result of the call is ignored.\nThe set of functions may be controlled using flags.",
"default": true
},
"fillreturns": {
"type": "boolean",
"description": "suggested fixes for \"wrong number of return values (want %d, got %d)\"\nThis checker provides suggested fixes for type errors of the\ntype \"wrong number of return values (want %d, got %d)\". For example:\n\tfunc m() (int, string, *bool, error) {\n\t\treturn\n\t}\nwill turn into\n\tfunc m() (int, string, *bool, error) {\n\t\treturn 0, \"\", nil, nil\n\t}\nThis functionality is similar to https://github.com/sqs/goreturns.",
"default": true
},
"nonewvars": {
"type": "boolean",
"description": "suggested fixes for \"no new vars on left side of :=\"\nThis checker provides suggested fixes for type errors of the\ntype \"no new vars on left side of :=\". For example:\n\tz := 1\n\tz := 2\nwill turn into\n\tz := 1\n\tz = 2",
"default": true
},
"noresultvalues": {
"type": "boolean",
"description": "suggested fixes for \"no result values expected\"\nThis checker provides suggested fixes for type errors of the\ntype \"no result values expected\". For example:\n\tfunc z() { return nil }\nwill turn into\n\tfunc z() { return }",
"default": true
},
"undeclaredname": {
"type": "boolean",
"description": "suggested fixes for \"undeclared name: <>\"\nThis checker provides suggested fixes for type errors of the\ntype \"undeclared name: <>\". It will insert a new statement:\n\"<> := \".",
"default": true
},
"fillstruct": {
"type": "boolean",
"description": "note incomplete struct initializations\nThis analyzer provides diagnostics for any struct literals that do not have\nany fields initialized. Because the suggested fix for this analysis is\nexpensive to compute, callers should compute it separately, using the\nSuggestedFix function below.",
"default": true
}
}
},
"annotations": {
"type": "object",
"patternProperties": {
".+": {
"type": "boolean"
}
},
"description": "**This setting is experimental and may be deleted.**\n\nannotations specifies the various kinds of optimization diagnostics\nthat should be reported by the gc_details command.\n\nCan contain any of:\n\n* `\"bounds\"` controls bounds checking diagnostics.\n\n* `\"escape\"` controls diagnostics about escape choices.\n\n* `\"inline\"` controls diagnostics about inlining choices.\n\n* `\"nil\"` controls nil checks.\n"
},
"buildFlags": {
"type": "array",
"items": {
"type": "string"
},
"description": "buildFlags is the set of flags passed on to the build system when invoked.\nIt is applied to queries like `go list`, which is used when discovering files.\nThe most common use is to set `-tags`.\n"
},
"codelenses": {
"type": "object",
"description": "codelenses overrides the enabled/disabled state of code lenses. See the\n\"Code Lenses\" section of the\n[Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md)\nfor the list of supported lenses.\n\nExample Usage:\n\n```json5\n\"gopls\": {\n...\n \"codelens\": {\n \"generate\": false, // Don't show the `go generate` lens.\n \"gc_details\": true // Show a code lens toggling the display of gc's choices.\n }\n...\n}\n```\n",
"additionalProperties": false,
"properties": {
"gc_details": {
"type": "boolean",
"default": false
},
"generate": {
"type": "boolean",
"default": true
},
"regenerate_cgo": {
"type": "boolean",
"default": true
},
"tidy": {
"type": "boolean",
"default": true
},
"upgrade_dependency": {
"type": "boolean",
"default": true
},
"vendor": {
"type": "boolean",
"default": true
}
}
},
"completionBudget": {
"type": "string",
"default": "100ms",
"description": "**This setting is for debugging purposes only.**\n\ncompletionBudget is the soft latency goal for completion requests. Most\nrequests finish in a couple milliseconds, but in some cases deep\ncompletions can take much longer. As we use up our budget we\ndynamically reduce the search scope to ensure we return timely\nresults. Zero means unlimited.\n"
},
"directoryFilters": {
"type": "array",
"items": {
"type": "string"
},
"description": "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nExamples:\nExclude node_modules: `-node_modules`\nInclude only project_a: `-` (exclude everything), `+project_a`\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n"
},
"env": {
"type": "object",
"patternProperties": {
".+": {
"type": "string"
}
},
"description": "env adds environment variables to external commands run by `gopls`, most notably `go list`.\n"
},
"expandWorkspaceToModule": {
"type": "boolean",
"default": true,
"description": "**This setting is experimental and may be deleted.**\n\nexpandWorkspaceToModule instructs `gopls` to adjust the scope of the\nworkspace to find the best available module root. `gopls` first looks for\na go.mod file in any parent directory of the workspace folder, expanding\nthe scope to that directory if it exists. If no viable parent directory is\nfound, gopls will check if there is exactly one child directory containing\na go.mod file, narrowing the scope to that directory if it exists.\n"
},
"experimentalDiagnosticsDelay": {
"type": "string",
"default": "250ms",
"description": "**This setting is experimental and may be deleted.**\n\nexperimentalDiagnosticsDelay controls the amount of time that gopls waits\nafter the most recent file modification before computing deep diagnostics.\nSimple diagnostics (parsing and type-checking) are always run immediately\non recently modified packages.\n\nThis option must be set to a valid duration string, for example `\"250ms\"`.\n"
},
"experimentalPackageCacheKey": {
"type": "boolean",
"default": true,
"description": "**This setting is experimental and may be deleted.**\n\nexperimentalPackageCacheKey controls whether to use a coarser cache key\nfor package type information to increase cache hits. This setting removes\nthe user's environment, build flags, and working directory from the cache\nkey, which should be a safe change as all relevant inputs into the type\nchecking pass are already hashed into the key. This is temporarily guarded\nby an experiment because caching behavior is subtle and difficult to\ncomprehensively test.\n"
},
"experimentalWorkspaceModule": {
"type": "boolean",
"default": false,
"description": "**This setting is experimental and may be deleted.**\n\nexperimentalWorkspaceModule opts a user into the experimental support\nfor multi-module workspaces.\n"
},
"gofumpt": {
"type": "boolean",
"default": false,
"description": "gofumpt indicates if we should run gofumpt formatting.\n"
},
"hoverKind": {
"type": "string",
"enum": [
"FullDocumentation",
"NoDocumentation",
"SingleLine",
"Structured",
"SynopsisDocumentation"
],
"default": "FullDocumentation",
"description": "hoverKind controls the information that appears in the hover text.\nSingleLine and Structured are intended for use only by authors of editor plugins.\n\nMust be one of:\n\n* `\"FullDocumentation\"`\n* `\"NoDocumentation\"`\n* `\"SingleLine\"`\n* `\"Structured\"` is an experimental setting that returns a structured hover format.\nThis format separates the signature from the documentation, so that the client\ncan do more manipulation of these fields.\\\nThis should only be used by clients that support this behavior.\n\n* `\"SynopsisDocumentation\"`\n"
},
"importShortcut": {
"type": "string",
"enum": [
"Both",
"Definition",
"Link"
],
"default": "Both",
"description": "importShortcut specifies whether import statements should link to\ndocumentation or go to definitions.\n\nMust be one of:\n\n* `\"Both\"`\n* `\"Definition\"`\n* `\"Link\"`\n"
},
"linksInHover": {
"type": "boolean",
"default": true,
"description": "linksInHover toggles the presence of links to documentation in hover.\n"
},
"linkTarget": {
"type": "string",
"default": "pkg.go.dev",
"description": "linkTarget controls where documentation links go.\nIt might be one of:\n\n* `\"godoc.org\"`\n* `\"pkg.go.dev\"`\n\nIf company chooses to use its own `godoc.org`, its address can be used as well.\n"
},
"local": {
"type": "string",
"default": "",
"description": "local is the equivalent of the `goimports -local` flag, which puts\nimports beginning with this string after third-party packages. It should\nbe the prefix of the import path whose imports should be grouped\nseparately.\n"
},
"matcher": {
"type": "string",
"enum": [
"CaseInsensitive",
"CaseSensitive",
"Fuzzy"
],
"default": "Fuzzy",
"description": "**This is an advanced setting and should not be configured by most `gopls` users.**\n\nmatcher sets the algorithm that is used when calculating completion\ncandidates.\n\nMust be one of:\n\n* `\"CaseInsensitive\"`\n* `\"CaseSensitive\"`\n* `\"Fuzzy\"`\n"
},
"semanticTokens": {
"type": "boolean",
"default": false,
"description": "**This setting is experimental and may be deleted.**\n\nsemanticTokens controls whether the LSP server will send\nsemantic tokens to the client.\n"
},
"staticcheck": {
"type": "boolean",
"default": false,
"description": "**This setting is experimental and may be deleted.**\n\nstaticcheck enables additional analyses from staticcheck.io.\n"
},
"symbolMatcher": {
"type": "string",
"enum": [
"CaseInsensitive",
"CaseSensitive",
"Fuzzy"
],
"default": "Fuzzy",
"description": "**This is an advanced setting and should not be configured by most `gopls` users.**\n\nsymbolMatcher sets the algorithm that is used when finding workspace symbols.\n\nMust be one of:\n\n* `\"CaseInsensitive\"`\n* `\"CaseSensitive\"`\n* `\"Fuzzy\"`\n"
},
"symbolStyle": {
"type": "string",
"enum": [
"Dynamic",
"Full",
"Package"
],
"default": "Dynamic",
"description": "**This is an advanced setting and should not be configured by most `gopls` users.**\n\nsymbolStyle controls how symbols are qualified in symbol responses.\n\nExample Usage:\n\n```json5\n\"gopls\": {\n...\n \"symbolStyle\": \"dynamic\",\n...\n}\n```\n\nMust be one of:\n\n* `\"Dynamic\"` uses whichever qualifier results in the highest scoring\nmatch for the given symbol query. Here a \"qualifier\" is any \"/\" or \".\"\ndelimited suffix of the fully qualified symbol. i.e. \"to/pkg.Foo.Field\" or\njust \"Foo.Field\".\n\n* `\"Full\"` is fully qualified symbols, i.e.\n\"path/to/pkg.Foo.Field\".\n\n* `\"Package\"` is package qualified symbols i.e.\n\"pkg.Foo.Field\".\n"
},
"usePlaceholders": {
"type": "boolean",
"default": false,
"description": "placeholders enables placeholders for function parameters or struct\nfields in completion responses.\n"
},
"verboseOutput": {
"type": "boolean",
"default": false,
"description": "**This setting is for debugging purposes only.**\n\nverboseOutput enables additional debug logging.\n"
}
}
},
"go.tags": {
"type": "object",
"properties": {
"tags": {
"type": "string",
"default": "json",
"description": "Comma separated tags to be used by `go.tags.add` command"
},
"options": {
"type": "string",
"default": "json=omitempty",
"description": "Comma separated tag=options pairs to be used by `go.tags.add` command"
},
"transform": {
"type": "string",
"enum": [
"snakecase",
"camelcase"
],
"default": "snakecase",
"description": "Transformation rule used by `go.tags.add` command to add tags"
},
"skipUnexported": {
"type": "boolean",
"default": false,
"description": "If true, skip unexported fields"
}
}
},
"go.tests": {
"type": "object",
"properties": {
"generateFlags": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Additional command line flags to pass to `gotests` for generating tests."
}
}
},
"go.checkForUpdates": {
"description": "[EXPERIMENTAL] Check for gopls updates on start.",
"type": "string",
"default": "disabled",
"enum": [
"disabled",
"inform",
"ask",
"install"
]
}
}
},
"commands": [
{
"title": "Generate interface stubs",
"category": "Go",
"command": "go.impl.cursor"
},
{
"title": "Install / update gomodifytags",
"category": "Go",
"command": "go.install.gomodifytags"
},
{
"title": "Install / update goplay",
"category": "Go",
"command": "go.install.goplay"
},
{
"title": "Install / update gopls",
"category": "Go",
"command": "go.install.gopls"
},
{
"title": "Install / update gotests",
"category": "Go",
"command": "go.install.gotests"
},
{
"title": "Install / update impl",
"category": "Go",
"command": "go.install.impl"
},
{
"title": "Install / update all tools",
"category": "Go",
"command": "go.install.tools"
},
{
"title": "Run on go playground",
"category": "Go",
"command": "go.playground"
},
{
"title": "Add tags to struct fields",
"category": "Go",
"command": "go.tags.add"
},
{
"title": "Add tags to struct field in current line",
"category": "Go",
"command": "go.tags.add.line"
},
{
"title": "Add tags to struct fields (prompt)",
"category": "Go",
"command": "go.tags.add.prompt"
},
{
"title": "Remove all tags from struct fields",
"category": "Go",
"command": "go.tags.clear"
},
{
"title": "Remove all tags from struct fields in current line",
"category": "Go",
"command": "go.tags.clear.line"
},
{
"title": "Remove tags from struct fields",
"category": "Go",
"command": "go.tags.remove"
},
{
"title": "Remove tags from struct field in current line",
"category": "Go",
"command": "go.tags.remove.line"
},
{
"title": "Remove tags from struct fields (prompt)",
"category": "Go",
"command": "go.tags.remove.prompt"
},
{
"title": "Generate unit tests for exported functions in file",
"category": "Go",
"command": "go.test.generate.exported"
},
{
"title": "Generate unit tests for file",
"category": "Go",
"command": "go.test.generate.file"
},
{
"title": "Generate unit tests for current function",
"category": "Go",
"command": "go.test.generate.function"
},
{
"title": "Toggle test file",
"category": "Go",
"command": "go.test.toggle"
},
{
"title": "Print extension version",
"category": "Go",
"command": "go.version"
}
],
"snippets": [
{
"language": "go",
"path": "./snippets/go.json"
},
{
"language": "gomod",
"path": "./snippets/gomod.json"
}
]
},
"devDependencies": {
"@types/mocha": "^8.0.3",
"@types/node": "^14.11.1",
"@types/node-fetch": "^2.5.7",
"@types/tmp": "^0.2.0",
"@types/which": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"coc-dev-tools": "^0.1.0",
"coc.nvim": "0.0.80",
"eslint": "^7.9.0",
"eslint-config-josa-typescript": "^0.1.2",
"mocha": "^8.1.3",
"rimraf": "^3.0.2",
"tmp": "^0.2.1",
"ts-node": "^9.0.0",
"typescript": "~4.1.2"
},
"dependencies": {
"node-fetch": "^2.6.1",
"tslib": "^2.0.0",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-uri": "^3.0.1",
"which": "^2.0.2"
}
}

View file

@ -1,447 +0,0 @@
{
"single import": {
"prefix": "im",
"body": [
"import \"${1:package}\""
],
"description": "import statement"
},
"multiple imports": {
"prefix": "ims",
"body": [
"import (",
"\t\"${1:package}\"",
")"
],
"description": "a import block"
},
"single constant": {
"prefix": "co",
"body": [
"const ${1:name} = ${2:value}"
],
"description": "a constant"
},
"multiple constants": {
"prefix": "cos",
"body": [
"const (",
"\t${1:name} = ${2:value}",
")"
],
"description": "a constant block"
},
"type interface declaration": {
"prefix": "tyi",
"body": [
"type ${1:name} interface {",
"\t$0",
"}"
],
"description": "a type interface"
},
"type struct declaration": {
"prefix": "tys",
"body": [
"type ${1:name} struct {",
"\t$0",
"}"
],
"description": "a struct declaration"
},
"package main and main function": {
"prefix": "pkgm",
"body": [
"package main",
"",
"func main() {",
"\t$0",
"}"
],
"description": "main package & function"
},
"function declaration": {
"prefix": "func",
"body": [
"func $1($2) $3 {",
"\t$0",
"}"
],
"description": "function declaration"
},
"variable declaration": {
"prefix": "var",
"body": [
"var ${1:name} ${2:type}"
],
"description": "a variable"
},
"switch statement": {
"prefix": "switch",
"body": [
"switch ${1:expression} {",
"case ${2:condition}:",
"\t$0",
"}"
],
"description": "switch statement"
},
"select statement": {
"prefix": "sel",
"body": [
"select {",
"case ${1:condition}:",
"\t$0",
"}"
],
"description": "select statement"
},
"case clause": {
"prefix": "cs",
"body": [
"case ${1:condition}:$0"
],
"description": "case clause"
},
"for statement": {
"prefix": "for",
"body": [
"for ${1:i} := 0; $1 < ${2:count}; $1${3:++} {",
"\t$0",
"}"
],
"description": "a for loop"
},
"for range statement": {
"prefix": "forr",
"body": [
"for ${1:_, }${2:var} := range ${3:var} {",
"\t$0",
"}"
],
"description": "a for range loop"
},
"channel declaration": {
"prefix": "ch",
"body": [
"chan ${1:type}"
],
"description": "a channel"
},
"map declaration": {
"prefix": "map",
"body": [
"map[${1:type}]${2:type}"
],
"description": "a map"
},
"empty interface": {
"prefix": "in",
"body": [
"interface{}"
],
"description": "empty interface"
},
"if statement": {
"prefix": "if",
"body": [
"if ${1:condition} {",
"\t$0",
"}"
],
"description": "if statement"
},
"else branch": {
"prefix": "el",
"body": [
"else {",
"\t$0",
"}"
],
"description": "else branch"
},
"if else statement": {
"prefix": "ie",
"body": [
"if ${1:condition} {",
"\t$2",
"} else {",
"\t$0",
"}"
],
"description": "if else"
},
"if err != nil": {
"prefix": "iferr",
"body": [
"if err != nil {",
"\t${1:return ${2:nil, }${3:err}}",
"}"
],
"description": "if err != nil"
},
"fmt.Println": {
"prefix": "fp",
"body": [
"fmt.Println(\"$1\")"
],
"description": "fmt.Println()"
},
"fmt.Printf": {
"prefix": "ff",
"body": [
"fmt.Printf(\"$1\", ${2:var})"
],
"description": "fmt.Printf()"
},
"log.Println": {
"prefix": "lp",
"body": [
"log.Println(\"$1\")"
],
"description": "log.Println()"
},
"log.Printf": {
"prefix": "lf",
"body": [
"log.Printf(\"$1\", ${2:var})"
],
"description": "log.Printf()"
},
"log variable content": {
"prefix": "lv",
"body": [
"log.Printf(\"${1:var}: %#+v\\\\n\", ${1:var})"
],
"description": "log.Printf() with variable content"
},
"t.Log": {
"prefix": "tl",
"body": [
"t.Log(\"$1\")"
],
"description": "t.Log()"
},
"t.Logf": {
"prefix": "tlf",
"body": [
"t.Logf(\"$1\", ${2:var})"
],
"description": "t.Logf()"
},
"t.Logf variable content": {
"prefix": "tlv",
"body": [
"t.Logf(\"${1:var}: %#+v\\\\n\", ${1:var})"
],
"description": "t.Logf() with variable content"
},
"make(...)": {
"prefix": "make",
"body": [
"make(${1:type}, ${2:0})"
],
"description": "make statement"
},
"new(...)": {
"prefix": "new",
"body": [
"new(${1:type})"
],
"description": "new statement"
},
"panic(...)": {
"prefix": "pn",
"body": [
"panic(\"$0\")"
],
"description": "panic"
},
"http ResponseWriter *Request": {
"prefix": "wr",
"body": [
"${1:w} http.ResponseWriter, ${2:r} *http.Request"
],
"description": "http Response"
},
"http.HandleFunc": {
"prefix": "hf",
"body": [
"${1:http}.HandleFunc(\"${2:/}\", ${3:handler})"
],
"description": "http.HandleFunc()"
},
"http handler declaration": {
"prefix": "hand",
"body": [
"func $1(${2:w} http.ResponseWriter, ${3:r} *http.Request) {",
"\t$0",
"}"
],
"description": "http handler declaration"
},
"http.Redirect": {
"prefix": "rd",
"body": [
"http.Redirect(${1:w}, ${2:r}, \"${3:/}\", ${4:http.StatusFound})"
],
"description": "http.Redirect()"
},
"http.Error": {
"prefix": "herr",
"body": [
"http.Error(${1:w}, ${2:err}.Error(), ${3:http.StatusInternalServerError})"
],
"description": "http.Error()"
},
"http.ListenAndServe": {
"prefix": "las",
"body": [
"http.ListenAndServe(\"${1::8080}\", ${2:nil})"
],
"description": "http.ListenAndServe"
},
"http.Serve": {
"prefix": "sv",
"body": [
"http.Serve(\"${1::8080}\", ${2:nil})"
],
"description": "http.Serve"
},
"goroutine anonymous function": {
"prefix": "go",
"body": [
"go func($1) {",
"\t$0",
"}($2)"
],
"description": "anonymous goroutine declaration"
},
"goroutine function": {
"prefix": "gf",
"body": [
"go ${1:func}($0)"
],
"description": "goroutine declaration"
},
"defer statement": {
"prefix": "df",
"body": [
"defer ${1:func}($0)"
],
"description": "defer statement"
},
"test function": {
"prefix": "tf",
"body": [
"func Test$1(t *testing.T) {",
"\t$0",
"}"
],
"description": "Test function"
},
"benchmark function": {
"prefix": "bf",
"body": [
"func Benchmark$1(b *testing.B) {",
"\tfor ${2:i} := 0; ${2:i} < b.N; ${2:i}++ {",
"\t\t$0",
"\t}",
"}"
],
"description": "Benchmark function"
},
"example function": {
"prefix": "ef",
"body": [
"func Example$1() {",
"\t$2",
"\t//Output:",
"\t$3",
"}"
],
"description": "Example function"
},
"table driven test": {
"prefix": "tdt",
"body": [
"func Test$1(t *testing.T) {",
"\ttestCases := []struct {",
"\t\tdesc\tstring",
"\t\t$2",
"\t}{",
"\t\t{",
"\t\t\tdesc: \"$3\",",
"\t\t\t$4",
"\t\t},",
"\t}",
"\tfor _, tC := range testCases {",
"\t\tt.Run(tC.desc, func(t *testing.T) {",
"\t\t\t$0",
"\t\t})",
"\t}",
"}"
],
"description": "table driven test"
},
"init function": {
"prefix": "finit",
"body": [
"func init() {",
"\t$1",
"}"
],
"description": "init function"
},
"main function": {
"prefix": "fmain",
"body": [
"func main() {",
"\t$1",
"}"
],
"description": "main function"
},
"method declaration": {
"prefix": "meth",
"body": [
"func (${1:receiver} ${2:type}) ${3:method}($4) $5 {",
"\t$0",
"}"
],
"description": "method declaration"
},
"hello world web app": {
"prefix": "helloweb",
"body": [
"package main",
"",
"import (",
"\t\"fmt\"",
"\t\"net/http\"",
"\t\"time\"",
")",
"",
"func greet(w http.ResponseWriter, r *http.Request) {",
"\tfmt.Fprintf(w, \"Hello World! %s\", time.Now())",
"}",
"",
"func main() {",
"\thttp.HandleFunc(\"/\", greet)",
"\thttp.ListenAndServe(\":8080\", nil)",
"}"
],
"description": "sample hello world webapp"
},
"sort implementation": {
"prefix": "sort",
"body": [
"type ${1:SortBy} []${2:Type}",
"",
"func (a $1) Len() int { return len(a) }",
"func (a $1) Swap(i, j int) { a[i], a[j] = a[j], a[i] }",
"func (a $1) Less(i, j int) bool { ${3:return a[i] < a[j]} }"
],
"description": "a custom sort.Sort interface implementation, for a given slice type."
}
}

View file

@ -1,37 +0,0 @@
{
"module": {
"prefix": "mod",
"body": [
"module ${1:github.com/org/name}"
],
"description": "define the module path"
},
"go": {
"prefix": "go",
"body": [
"go ${1:1.13}"
],
"description": "set the expected language version"
},
"require": {
"prefix": "require",
"body": [
"require ${1:module} ${2:version}"
],
"description": "require a particular module at a given version or later"
},
"exclude": {
"prefix": "exclude",
"body": [
"exclude ${1:module} $(2:version}"
],
"description": "exclude a particular module version from use"
},
"replace": {
"prefix": "replace",
"body": [
"replace ${1:module} => ${2:replace}"
],
"description": "replace a module version with a different module version"
}
}

View file

@ -1,65 +0,0 @@
# coc-json
Json language server extension for [coc.nvim](https://github.com/neoclide/coc.nvim).
The server code is extracted from VSCode, which uses
[vscode-json-languageservice](https://www.npmjs.com/package/vscode-json-languageservice)
For highlight of jsonc filetype, you may need [jsonc.vim](https://github.com/neoclide/jsonc.vim)
## Install
In your vim/neovim, run the following command:
```
:CocInstall coc-json
```
## Features
Same as VSCode.
All features of [vscode-json-languageservice](https://www.npmjs.com/package/vscode-json-languageservice) are supported.
- `doCompletion` for JSON properties and values based on the document's JSON schema.
- `doHover` for values based on descriptions in the document's JSON schema.<Paste>
- Document Symbols for quick navigation to properties in the document.
- Document Colors for showing color decorators on values representing colors.
- Code Formatting supporting ranges and formatting the whole document.
- Diagnostics (Validation) are pushed for all open documents
- syntax errors
- structural validation based on the document's JSON schema.
## Commands
- `json.retryResolveSchema`: Retry resolve schema of current buffer.
## Configuration options
- `json.enable` set to `false` to disable json language server.
- `json.trace.server` trace LSP traffic in output channel.
- `json.execArgv` add `execArgv` to `child_process.fork` used for start
json language server.
- `json.format.enable` set to `false` to disable format.
- `json.schemas` schema associations for json files.
## FAQ
### How to suppress error `[json 521] [e] Comments are not permitted in JSON`?
You can configure your vim to make that file with jsonc filetype to allow comment.
### How to add custom schema definitions/properties?
You have two choices:
- use `$schema` in your json.
- create json schema file and then configure `json.schemes` in your `coc-settings.json`, check out https://github.com/neoclide/coc-json/blob/master/package.json#L55
### Quotes are hidden?
This is not caused by coc-json, you may checkout the `conceallevel` option.
## License
MIT

View file

@ -1,50 +0,0 @@
const path = require('path')
let entryPlugin = {
name: 'entry',
setup(build) {
build.onResolve({filter: /^(index|server)\.ts$/}, args => {
return {
path: args.path,
namespace: 'entry-ns'
}
})
build.onLoad({filter: /.*/, namespace: 'entry-ns'}, args => {
let contents = ''
if (args.path == 'index.ts') {
contents = `
import {activate} from './src/index'
export {activate}
`
} else if (args.path == 'server.ts') {
contents = `require('./server/node/jsonServerMain')`
} else {
throw new Error('Bad path')
}
return {
contents,
resolveDir: __dirname
}
})
}
}
async function start() {
await require('esbuild').build({
entryPoints: ['index.ts', 'server.ts'],
define: {'process.env.NODE_ENV': JSON.stringify("production")},
bundle: true,
platform: 'node',
target: 'node12.16',
mainFields: ['module', 'main'],
minify: true,
sourcemap: true,
external: ['coc.nvim'],
outdir: path.resolve(__dirname, 'lib'),
plugins: [entryPlugin]
})
}
start().catch(e => {
console.error(e)
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,119 +0,0 @@
{
"name": "coc-json",
"version": "1.3.4",
"description": "Json extension for coc.nvim",
"main": "lib/index.js",
"publisher": "chemzqm",
"keywords": [
"coc.nvim",
"json"
],
"engines": {
"coc": ">= 0.0.80"
},
"scripts": {
"prepare": "node esbuild.js"
},
"activationEvents": [
"onLanguage:json",
"onLanguage:jsonc"
],
"contributes": {
"configuration": {
"type": "object",
"title": "Json",
"properties": {
"json.enable": {
"type": "boolean",
"default": true,
"description": "Enable json server"
},
"json.trace.server": {
"type": "string",
"default": "off",
"enum": [
"off",
"messages",
"verbose"
]
},
"json.execArgv": {
"type": "array",
"default": [],
"items": {
"type": "string"
}
},
"json.format.enable": {
"type": "boolean",
"default": true,
"description": "Enable format for json server"
},
"json.maxItemsComputed": {
"type": "number",
"default": 5000,
"description": "The maximum number of outline symbols and folding regions computed (limited for performance reasons)."
},
"json.schemaDownload.enable": {
"type": "boolean",
"default": true,
"description": "When enabled, JSON schemas can be fetched from http and https locations.",
"tags": [
"usesOnlineServices"
]
},
"json.schemas": {
"type": "array",
"scope": "resource",
"description": "Schemas associations for json files",
"default": [],
"items": {
"type": "object",
"default": {
"fileMatch": [
"/my-file"
],
"url": "schemaURL"
},
"properties": {
"url": {
"type": "string",
"default": "/user.schema.json"
},
"fileMatch": {
"type": "array",
"items": {
"type": "string",
"default": "MyFile.json"
},
"minItems": 1,
"description": "File pattern to match."
},
"schema": {
"$ref": "http://json-schema.org/draft-04/schema#",
"description": "Url of json schema, support file/url protocol."
}
}
}
}
}
}
},
"author": "chemzqm@gmail.com",
"license": "MIT",
"devDependencies": {
"@chemzqm/tsconfig": "^0.0.3",
"@types/node": "^10.12.0",
"esbuild": "^0.8.29",
"coc.nvim": "^0.0.80",
"request-light": "^0.4.0",
"rimraf": "^3.0.2",
"strip-bom": "^4.0.0",
"typescript": "^4.1.3",
"vscode-json-languageservice": "^3.8.3",
"vscode-languageserver": "7.0.0-next.3",
"vscode-languageserver-protocol": "^3.15.3",
"vscode-uri": "^2.1.2"
},
"dependencies": {}
}

View file

@ -1,6 +0,0 @@
#! /bin/bash
curl https://raw.githubusercontent.com/qiu8310/minapp/master/schema/app.json > ./data/app.json
curl https://raw.githubusercontent.com/qiu8310/minapp/master/schema/page.json > ./data/page.json
curl https://raw.githubusercontent.com/qiu8310/minapp/master/schema/component.json > ./data/component.json
curl https://schemastore.azurewebsites.net/api/json/catalog.json > ./src/catalog.json

View file

@ -1,4 +0,0 @@
# These are supported funding model platforms
patreon: chemzqm
custom: https://paypal.me/chezqm

View file

@ -1,172 +0,0 @@
# coc-yaml
Fork of [vscode-yaml](https://github.com/redhat-developer/vscode-yaml) that
works with [coc.nvim](https://github.com/neoclide/coc.nvim)
## Supporting
If you like my work, consider supporting me on Patreon or PayPal:
<a href="https://www.patreon.com/chemzqm"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /> </a>
<a href="https://www.paypal.com/paypalme/chezqm"><img src="https://werwolv.net/assets/paypal_banner.png" alt="PayPal donate button" /> </a>
## Install
In your vim/neovim, run command:
```
:CocInstall coc-yaml
```
## Features
![screencast](https://raw.githubusercontent.com/redhat-developer/vscode-yaml/master/images/demo.gif)
1. YAML validation:
- Detects whether the entire file is valid yaml
- Detects errors such as:
- Node is not found
- Node has an invalid key node type
- Node has an invalid type
- Node is not a valid child node
2. Document Outlining (<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>O</kbd>):
- Provides the document outlining of all completed nodes in the file
3. Auto completion (<kbd>Ctrl</kbd> + <kbd>Space</kbd>):
- Auto completes on all commands
- Scalar nodes autocomplete to schema's defaults if they exist
4. Hover support:
- Hovering over a node shows description _if provided by schema_
5. Formatter:
- Allows for formatting the current file
_Auto completion and hover support are provided by the schema. Please refer to Language Server Settings to setup a schema_
# Language Server Settings
The following settings are supported:
- `yaml.format.enable` (default: `false`): Enable/disable default YAML formatter (requires restart)
- `yaml.format.singleQuote` (default: `false`): Use single quotes instead of double quotes
- `yaml.format.bracketSpacing` (default: `true`): Print spaces between brackets in objects
- `yaml.format.proseWrap` (default: `"preserve"`): `"always"`: wrap prose if it exeeds the print width, `"never"`: never wrap the prose, `"preserve"`: wrap prose as-is
- `yaml.format.printWidth`: Specify the line length that the printer will wrap on
- `yaml.validate` (default: `true`): Enable/disable validation feature
- `yaml.hover` (default: `true`): Enable/disable hover
- `yaml.completion` (default: `true`): Enable/disable autocompletion
- `yaml.schemas` (default: `{}`): Helps you associate schemas with files in a glob pattern
- `yaml.schemaStore.enable`: When set to true the YAML language server will pull in all available schemas from [JSON Schema Store](http://schemastore.org/json/)
- `yaml.customTags` (default: `[]`): Array of custom tags that the parser will validate against. It has two ways to be used. Either an item in the array is a custom tag such as "!Ref" or you can specify the type of the object !Ref should be by doing "!Ref Scalar". For example: ["!Ref", "!Some-Tag Scalar"]. The type of object can be one of Scalar, Sequence, Mapping, Map.
- `[yaml]`: VSCode-YAML adds default configuration for all yaml files. More specifically it converts tabs to spaces to ensure valid yaml, sets the tab size, and allows live typing autocompletion. These settings can be modified via the corresponding settings inside the `[yaml]` section in the settings:
- `editor.insertSpaces`
- `editor.tabSize`
- `editor.quickSuggestions`
**Note** `insertSpaces` and `tabSize` settings may not work, you need ensure `&shiftwidth` and `&expandtab` options of your yaml buffer.
##### Adding custom tags
In order to use the custom tags in your YAML file you need to first specify the custom tags in the setting of your code editor. For example, you can have the following custom tags:
```YAML
"yaml.customTags": [
"!Scalar-example scalar",
"!Seq-example sequence",
"!Mapping-example mapping"
]
```
The !Scalar-example would map to a scalar custom tag, the !Seq-example would map to a sequence custom tag, the !Mapping-example would map to a mapping custom tag.
You can then use the newly defined custom tags inside the YAML file:
```YAML
some_key: !Scalar-example some_value
some_sequence: !Seq-example
- some_seq_key_1: some_seq_value_1
- some_seq_key_2: some_seq_value_2
some_mapping: !Mapping-example
some_mapping_key_1: some_mapping_value_1
some_mapping_key_2: some_mapping_value_2
```
##### Associating a schema to a glob pattern via yaml.schemas:
yaml.schemas applies a schema to a file. In other words, the schema (placed on the left) is applied to the glob pattern on the right. Your schema can be local or online. Your schema must be a relative path and not an absolute path.
When associating a schema it should follow the format below
```JSON
"yaml.schemas": {
"url": "globPattern",
"Kubernetes": "globPattern"
}
```
e.g.
```JSON
"yaml.schemas": {
"http://json.schemastore.org/composer": ["/*"],
"file:///home/johnd/some-schema.json": ["some.yaml"],
"../relative/path/schema.json": ["/config*.yaml"],
"/Users/johnd/some-schema.json": ["some.yaml"],
}
```
e.g.
```JSON
"yaml.schemas": {
"kubernetes": ["/myYamlFile.yaml"]
}
```
e.g.
```JSON
"yaml.schemas": {
"http://json.schemastore.org/composer": ["/*"],
"kubernetes": ["/myYamlFile.yaml"]
}
```
Since `0.11.0` YAML Schemas can be used for validation:
```json
"/home/user/custom_schema.yaml": "someFilePattern.yaml"
```
- The entrance point for `yaml.schemas` is location in [user and workspace settings](https://code.visualstudio.com/docs/getstarted/settings#_creating-user-and-workspace-settings)
- Supports schemas through [schema store](http://schemastore.org/json/) as well as any other schema url
- Supports 'yamlValidation' point which allows you to contribute a schema for a specific type of yaml file (Similar to [jsonValidation](https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesjsonvalidation))
e.g.
```JSON
{
"contributes": {
"yamlValidation": [
{
"fileMatch": "yourfile.yml",
"url": "./schema.json"
}
]
}
}
```
This extension allows you to specify json schemas that you want to validate against the yaml that you write. In the vscode user and workspace preferences you can set a url and a glob pattern that you want to validate against the schema. Kubernetes is an optional field. They do not require a url as the language server will provide that. You just need the keyword kubernetes and a glob pattern.
## Debug
Add `"yaml.trace.server": "verbose"` to your `coc-settings.json` to get verbose
output of LSP communication.
Open output channel by command:
```
:CocCommand workspace.showOutput yaml
```
## License
MIT

Some files were not shown because too many files have changed in this diff Show more