diff --git a/CHANGELOG.md b/CHANGELOG.md index 991e180..87aeb28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,13 +16,13 @@ See the full list of recent releases and features added on the ## v2.15.0 - 2022-09-27 -- Syntax highlighting for await and concurrent. Thanks [Wilfred](https://github.com/Wilfred)! +- Syntax highlighting for await and concurrent. Thanks [Wilfred](https://github.com/Wilfred)! - Syntax highlighting for modules. Thanks [panopticoncentral](https://github.com/panopticoncentral)! ## v2.14.0 - 2022-08-25 - Lots of syntax highlighting fixes. Thanks [Wilfred](https://github.com/Wilfred)! -- Fix file path mappings on Windows. Thanks [skoro](https://github.com/skoro)! +- Fix file path mappings on Windows. Thanks [skoro](https://github.com/skoro)! ## v2.13.0 - 2022-03-09 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b4612a7..e609479 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -8,8 +8,8 @@ culture where everyone feels included. Salesforce open-source projects are committed to providing a friendly, safe, and welcoming environment for all, regardless of gender identity and expression, -sexual orientation, disability, physical appearance, body size, ethnicity, nationality, -race, age, religion, level of experience, education, socioeconomic status, or +sexual orientation, disability, physical appearance, body size, ethnicity, nationality, +race, age, religion, level of experience, education, socioeconomic status, or other similar personal characteristics. The goal of this code of conduct is to specify a baseline standard of behavior so @@ -25,9 +25,9 @@ Open Source Conduct Committee at ossconduct@salesforce.com. In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of gender -identity and expression, sexual orientation, disability, physical appearance, -body size, ethnicity, nationality, race, age, religion, level of experience, education, +our community a harassment-free experience for everyone, regardless of gender +identity and expression, sexual orientation, disability, physical appearance, +body size, ethnicity, nationality, race, age, religion, level of experience, education, socioeconomic status, or other similar personal characteristics. ## Our Standards @@ -35,23 +35,23 @@ socioeconomic status, or other similar personal characteristics. Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy toward other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy toward other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or -advances -* Personal attacks, insulting/derogatory comments, or trolling -* Public or private harassment -* Publishing, or threatening to publish, others' private information—such as -a physical or electronic address—without explicit permission -* Other conduct which could reasonably be considered inappropriate in a -professional setting -* Advocating for or encouraging any of the above behaviors +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Personal attacks, insulting/derogatory comments, or trolling +- Public or private harassment +- Publishing, or threatening to publish, others' private information—such as + a physical or electronic address—without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting +- Advocating for or encouraging any of the above behaviors ## Our Responsibilities @@ -77,29 +77,29 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the Salesforce Open Source Conduct Committee -at ossconduct@salesforce.com. All complaints will be reviewed and investigated -and will result in a response that is deemed necessary and appropriate to the -circumstances. The committee is obligated to maintain confidentiality with -regard to the reporter of an incident. Further details of specific enforcement +reported by contacting the Salesforce Open Source Conduct Committee +at ossconduct@salesforce.com. All complaints will be reviewed and investigated +and will result in a response that is deemed necessary and appropriate to the +circumstances. The committee is obligated to maintain confidentiality with +regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other -members of the project's leadership and the Salesforce Open Source Conduct +members of the project's leadership and the Salesforce Open Source Conduct Committee. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home], -version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html. -It includes adaptions and additions from [Go Community Code of Conduct][golang-coc], +version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html. +It includes adaptions and additions from [Go Community Code of Conduct][golang-coc], [CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc]. This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us]. -[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/) +[contributor-covenant-home]: https://www.contributor-covenant.org "https://www.contributor-covenant.org/" [golang-coc]: https://golang.org/conduct [cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md [microsoft-coc]: https://opensource.microsoft.com/codeofconduct/ -[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/ \ No newline at end of file +[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/ diff --git a/NOTICE.md b/NOTICE.md index b848034..2bcc968 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1,52 +1,52 @@ # Third-party notices - -This document includes licensing information relating to free, open-source, and public-source software (together, the “SOFTWARE”) included with or used while developing Slack’s `vscode-hack` software. The terms of the applicable free, open-source, and public-source licenses (each an “OSS LICENSE”) govern Slack’s distribution and your use of the SOFTWARE. Slack and the third-party authors, licensors, and distributors of the SOFTWARE disclaim all warranties and liability arising from all use and distribution of the SOFTWARE. To the extent the OSS is provided under an agreement with Slack that differs from the applicable OSS LICENSE, those terms are offered by Slack alone. - +This document includes licensing information relating to free, open-source, and public-source software (together, the “SOFTWARE”) included with or used while developing Slack’s `vscode-hack` software. The terms of the applicable free, open-source, and public-source licenses (each an “OSS LICENSE”) govern Slack’s distribution and your use of the SOFTWARE. Slack and the third-party authors, licensors, and distributors of the SOFTWARE disclaim all warranties and liability arising from all use and distribution of the SOFTWARE. To the extent the OSS is provided under an agreement with Slack that differs from the applicable OSS LICENSE, those terms are offered by Slack alone. Slack has reproduced below copyright and other licensing notices appearing within the SOFTWARE. While Slack seeks to provide complete and accurate copyright and licensing information for each SOFTWARE package, Slack does not represent or warrant that the following information is complete, correct, or error-free. SOFTWARE recipients are encouraged to (a) investigate the identified SOFTWARE packages to confirm the accuracy of the licensing information provided herein and (b) notify Slack of any inaccuracies or errors found in this document so that Slack may update this document accordingly. - Certain OSS LICENSES (such as the GNU General Public Licenses, GNU Library/Lesser General Public Licenses, Affero General Public Licenses, Mozilla Public Licenses, Common Development and Distribution Licenses, Common Public License, and Eclipse Public License) require that the source code corresponding to distributed OSS binaries be made available to recipients or other requestors under the terms of the same OSS LICENSE. Recipients or requestors who would like to receive a copy of such corresponding source code should submit a request to Slack by post at: - Slack Attn: Open Source Requests 500 Howard St. San Francisco, CA 94105 --- + **[@vscode/debugadapter@1.61.0](https://github.com/microsoft/vscode-debugadapter-node)** + ``` -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. - +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. ``` **[@vscode/debugprotocol@1.61.0](https://github.com/microsoft/vscode-debugadapter-node)** + ``` -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. - +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. ``` **[semver@5.7.2](https://github.com/npm/node-semver)** + ``` The ISC License @@ -66,62 +66,65 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ``` **[vscode-jsonrpc@4.0.0](https://github.com/Microsoft/vscode-languageserver-node)** + ``` -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. - +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. ``` **[vscode-languageclient@5.2.1](https://github.com/Microsoft/vscode-languageserver-node)** + ``` -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. - +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. ``` **[vscode-languageserver-protocol@3.14.1](https://github.com/Microsoft/vscode-languageserver-node)** + ``` -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. - +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. ``` **[vscode-languageserver-types@3.14.0](https://github.com/Microsoft/vscode-languageserver-node)** + ``` -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. - +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. ``` - diff --git a/SECURITY.md b/SECURITY.md index e31774d..8249025 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,4 +4,4 @@ Please report any security issue to [security@salesforce.com](mailto:security@sa as soon as it is discovered. This library limits its runtime dependencies in order to reduce the total cost of ownership as much as can be, but all consumers should remain vigilant and have their security stakeholders review all third-party -products (3PP) like this one and their dependencies. \ No newline at end of file +products (3PP) like this one and their dependencies. diff --git a/build/notice-file-generate.js b/build/notice-file-generate.js index d9720ec..411de83 100644 --- a/build/notice-file-generate.js +++ b/build/notice-file-generate.js @@ -14,16 +14,16 @@ checker.init( start: `${__dirname}/..`, production: true, customFormat: { - licenseText: "" - } + licenseText: "", + }, }, - function(err, packages) { + function (err, packages) { if (err) { console.error(`Failed to generate NOTICE.md file: ${err.stack}`); process.exit(1); } else { var stream = fs.createWriteStream( - path.resolve(__dirname, "..", "NOTICE.md") + path.resolve(__dirname, "..", "NOTICE.md"), ); stream.write(`# Third-party notices\n\n This document includes licensing information relating to free, open-source, and public-source software (together, the “SOFTWARE”) included with or used while developing Slack’s \`vscode-hack\` software. The terms of the applicable free, open-source, and public-source licenses (each an “OSS LICENSE”) govern Slack’s distribution and your use of the SOFTWARE. Slack and the third-party authors, licensors, and distributors of the SOFTWARE disclaim all warranties and liability arising from all use and distribution of the SOFTWARE. To the extent the OSS is provided under an agreement with Slack that differs from the applicable OSS LICENSE, those terms are offered by Slack alone.\n\n @@ -44,5 +44,5 @@ San Francisco, CA 94105\n\n---\n`); stream.end(); console.log(`NOTICE.md successfully written at ${stream.path}\n`); } - } + }, ); diff --git a/src/Config.ts b/src/Config.ts index 9e9780f..2f974e1 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -8,24 +8,24 @@ import * as vscode from "vscode"; const hackConfig = vscode.workspace.getConfiguration("hack"); // tslint:disable-next-line:no-non-null-assertion -export const localWorkspacePath = vscode.workspace.workspaceFolders![0].uri - .fsPath; +export const localWorkspacePath = + vscode.workspace.workspaceFolders![0].uri.fsPath; export let clientPath = hackConfig.get("clientPath") || "hh_client"; clientPath = clientPath.replace("${workspaceFolder}", localWorkspacePath); export const enableCoverageCheck = hackConfig.get( "enableCoverageCheck", - true + true, ); export const useLanguageServer = hackConfig.get( "useLanguageServer", - true + true, ); export const useHhast = hackConfig.get("useHhast", true); export const hhastLintMode: "whole-project" | "open-files" = hackConfig.get( "hhastLintMode", - "whole-project" + "whole-project", ); export const hhastPath = hackConfig.get("hhastPath") || "/vendor/bin/hhast-lint"; @@ -34,25 +34,25 @@ export const hhastArgs = hackConfig.get("hhastArgs", []); export const remoteEnabled = hackConfig.get("remote.enabled", false); export const remoteType: "ssh" | "docker" | undefined = hackConfig.get( "remote.type", - undefined + undefined, ); export const remoteWorkspacePath = hackConfig.get( - "remote.workspacePath" + "remote.workspacePath", ); export const sshHost = hackConfig.get("remote.ssh.host", ""); export const sshArgs = hackConfig.get("remote.ssh.args", []); export const dockerContainerName = hackConfig.get( "remote.docker.containerName", - "" + "", ); // Prompt to reload workspace on certain configuration updates -vscode.workspace.onDidChangeConfiguration(async event => { +vscode.workspace.onDidChangeConfiguration(async (event) => { if (event.affectsConfiguration("hack.remote")) { const selection = await vscode.window.showInformationMessage( "Please reload your workspace to apply the latest Hack configuration changes.", { modal: true }, - "Reload" + "Reload", ); if (selection === "Reload") { vscode.commands.executeCommand("workbench.action.reloadWindow"); diff --git a/src/HhvmDebugConfigurationProvider.ts b/src/HhvmDebugConfigurationProvider.ts index a029b74..37a405b 100644 --- a/src/HhvmDebugConfigurationProvider.ts +++ b/src/HhvmDebugConfigurationProvider.ts @@ -4,15 +4,16 @@ import { DebugConfigurationProvider, DebugConfiguration, CancellationToken, - ProviderResult + ProviderResult, } from "vscode"; export class HhvmDebugConfigurationProvider - implements DebugConfigurationProvider { + implements DebugConfigurationProvider +{ resolveDebugConfiguration( folder: WorkspaceFolder | undefined, debugConfig: DebugConfiguration, - _token?: CancellationToken + _token?: CancellationToken, ): ProviderResult { // if launch.json is missing or empty if ( diff --git a/src/LSPHHASTLint.ts b/src/LSPHHASTLint.ts index 0bfab01..e858556 100644 --- a/src/LSPHHASTLint.ts +++ b/src/LSPHHASTLint.ts @@ -6,7 +6,7 @@ import * as fs from "fs"; import * as vscode from "vscode"; import { HandleDiagnosticsSignature, - LanguageClient + LanguageClient, } from "vscode-languageclient"; import * as config from "./Config"; import * as remote from "./remote"; @@ -27,7 +27,7 @@ export class LSPHHASTLint { config.remoteEnabled && config.remoteWorkspacePath ? hhastPath.replace( config.localWorkspacePath, - config.remoteWorkspacePath + config.remoteWorkspacePath, ) : hhastPath; } @@ -36,14 +36,14 @@ export class LSPHHASTLint { * enables HHAST support for this project. */ public static async START_IF_CONFIGURED_AND_ENABLED( - context: vscode.ExtensionContext + context: vscode.ExtensionContext, ): Promise { if (!config.useHhast) { return; } const workspace = config.localWorkspacePath; const usesLint: boolean = await new Promise((resolve, _) => - fs.access(`${workspace}/hhast-lint.json`, err => resolve(!err)) + fs.access(`${workspace}/hhast-lint.json`, (err) => resolve(!err)), ); if (!usesLint) { return; @@ -58,7 +58,7 @@ export class LSPHHASTLint { return; } const hhastExists: boolean = await new Promise((resolve, _) => - fs.access(hhastPath, err => resolve(!err)) + fs.access(hhastPath, (err) => resolve(!err)), ); if (!hhastExists) { return; @@ -84,20 +84,20 @@ export class LSPHHASTLint { "--mode", "lsp", "--from", - "vscode-hack" - ]) + "vscode-hack", + ]), }, { documentSelector: [{ language: "hack", scheme: "file" }], initializationOptions: initializationOptions, uriConverters: { code2Protocol: utils.mapFromWorkspaceUri, - protocol2Code: utils.mapToWorkspaceUri + protocol2Code: utils.mapToWorkspaceUri, }, middleware: { - handleDiagnostics: this.handleDiagnostics - } - } + handleDiagnostics: this.handleDiagnostics, + }, + }, ); this.context.subscriptions.push(hhast.start()); } @@ -105,14 +105,14 @@ export class LSPHHASTLint { private handleDiagnostics( uri: vscode.Uri, diagnostics: vscode.Diagnostic[], - next: HandleDiagnosticsSignature + next: HandleDiagnosticsSignature, ) { next( uri, - diagnostics.map(d => { + diagnostics.map((d) => { d.message = `${d.code}: ${d.message}`; return d; - }) + }), ); } } diff --git a/src/LSPHackTypeChecker.ts b/src/LSPHackTypeChecker.ts index 99c1901..b5c2526 100644 --- a/src/LSPHackTypeChecker.ts +++ b/src/LSPHackTypeChecker.ts @@ -8,7 +8,7 @@ import { LanguageClient, RevealOutputChannelOn, LanguageClientOptions, - ServerOptions + ServerOptions, } from "vscode-languageclient"; import * as config from "./Config"; import { HackCoverageChecker } from "./coveragechecker"; @@ -26,7 +26,7 @@ export class LSPHackTypeChecker { this.context = context; this.versionText = this.getVersionText(version); this.status = vscode.window.createStatusBarItem( - vscode.StatusBarAlignment.Left + vscode.StatusBarAlignment.Left, ); context.subscriptions.push(this.status); } @@ -44,7 +44,7 @@ export class LSPHackTypeChecker { const serverOptions: ServerOptions = { command: remote.getCommand(config.clientPath), - args: remote.getArgs(config.clientPath, ["lsp", "--from", "vscode-hack"]) + args: remote.getArgs(config.clientPath, ["lsp", "--from", "vscode-hack"]), }; const clientOptions: LanguageClientOptions = { @@ -52,21 +52,21 @@ export class LSPHackTypeChecker { initializationOptions: { useTextEditAutocomplete: true }, uriConverters: { code2Protocol: utils.mapFromWorkspaceUri, - protocol2Code: utils.mapToWorkspaceUri + protocol2Code: utils.mapToWorkspaceUri, }, middleware: { - handleDiagnostics: this.handleDiagnostics + handleDiagnostics: this.handleDiagnostics, }, // Hack returns errors if commands fail due to syntax errors. Don't // automatically switch to the Output pane in this case. - revealOutputChannelOn: RevealOutputChannelOn.Never + revealOutputChannelOn: RevealOutputChannelOn.Never, }; const languageClient = new LanguageClient( "hack", "Hack Language Server", serverOptions, - clientOptions + clientOptions, ); languageClient.onReady().then(async () => { languageClient.onRequest( @@ -85,7 +85,7 @@ export class LSPHackTypeChecker { this.status.show(); return {}; - } + }, ); if ( @@ -102,11 +102,11 @@ export class LSPHackTypeChecker { private handleDiagnostics( uri: vscode.Uri, diagnostics: vscode.Diagnostic[], - next: HandleDiagnosticsSignature + next: HandleDiagnosticsSignature, ) { next( uri, - diagnostics.map(d => { + diagnostics.map((d) => { // See https://github.com/facebook/hhvm/blob/028402226993d53d68e17125e0b7c8dd87ea6c17/hphp/hack/src/errors/errors.ml#L174 let kind: string; switch (Math.floor(d.code / 1000)) { @@ -133,7 +133,7 @@ export class LSPHackTypeChecker { } d.message = `${kind}[${d.code}] ${d.message}`; return d; - }) + }), ); } diff --git a/src/LegacyHackTypeChecker.ts b/src/LegacyHackTypeChecker.ts index 0a7522f..5c52e77 100644 --- a/src/LegacyHackTypeChecker.ts +++ b/src/LegacyHackTypeChecker.ts @@ -15,30 +15,30 @@ export class LegacyHackTypeChecker { // register language functionality providers const HACK_MODE: vscode.DocumentFilter = { language: "hack", - scheme: "file" + scheme: "file", }; context.subscriptions.push( vscode.languages.registerHoverProvider( HACK_MODE, - new providers.HackHoverProvider() - ) + new providers.HackHoverProvider(), + ), ); context.subscriptions.push( vscode.languages.registerDocumentSymbolProvider( HACK_MODE, - new providers.HackDocumentSymbolProvider() - ) + new providers.HackDocumentSymbolProvider(), + ), ); context.subscriptions.push( vscode.languages.registerWorkspaceSymbolProvider( - new providers.HackWorkspaceSymbolProvider() - ) + new providers.HackWorkspaceSymbolProvider(), + ), ); context.subscriptions.push( vscode.languages.registerDocumentHighlightProvider( HACK_MODE, - new providers.HackDocumentHighlightProvider() - ) + new providers.HackDocumentHighlightProvider(), + ), ); context.subscriptions.push( vscode.languages.registerCompletionItemProvider( @@ -47,37 +47,36 @@ export class LegacyHackTypeChecker { "$", ">", ":", - "\\" - ) + "\\", + ), ); context.subscriptions.push( vscode.languages.registerDocumentFormattingEditProvider( HACK_MODE, - new providers.HackDocumentFormattingEditProvider() - ) + new providers.HackDocumentFormattingEditProvider(), + ), ); context.subscriptions.push( vscode.languages.registerReferenceProvider( HACK_MODE, - new providers.HackReferenceProvider() - ) + new providers.HackReferenceProvider(), + ), ); context.subscriptions.push( vscode.languages.registerDefinitionProvider( HACK_MODE, - new providers.HackDefinitionProvider() - ) + new providers.HackDefinitionProvider(), + ), ); // create typechecker and run when workspace is first loaded and on every file save - const hhvmTypeDiag: vscode.DiagnosticCollection = vscode.languages.createDiagnosticCollection( - "hack_typecheck" - ); + const hhvmTypeDiag: vscode.DiagnosticCollection = + vscode.languages.createDiagnosticCollection("hack_typecheck"); this.hhvmTypeDiag = hhvmTypeDiag; context.subscriptions.push( vscode.workspace.onDidSaveTextDocument(() => { this.run(); - }) + }), ); context.subscriptions.push(hhvmTypeDiag); } @@ -91,17 +90,17 @@ export class LegacyHackTypeChecker { } const diagnosticMap: Map = new Map(); - typecheckResult.errors.forEach(error => { + typecheckResult.errors.forEach((error) => { const diagnostic = new vscode.Diagnostic( new vscode.Range( new vscode.Position( error.message[0].line - 1, - error.message[0].start - 1 + error.message[0].start - 1, ), - new vscode.Position(error.message[0].line - 1, error.message[0].end) + new vscode.Position(error.message[0].line - 1, error.message[0].end), ), `${error.message[0].descr} [${error.message[0].code}]`, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); diagnostic.code = error.message[0].code; @@ -116,16 +115,16 @@ export class LegacyHackTypeChecker { new vscode.Range( new vscode.Position( error.message[i].line - 1, - error.message[i].start - 1 + error.message[i].start - 1, ), new vscode.Position( error.message[i].line - 1, - error.message[i].end - ) - ) + error.message[i].end, + ), + ), ), - error.message[i].descr - ) + error.message[i].descr, + ), ); } diagnostic.relatedInformation = relatedInformation; diff --git a/src/Utils.ts b/src/Utils.ts index 658f79a..09e5f45 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -8,8 +8,8 @@ import * as config from "./Config"; const localPath = getUriFilePath(config.localWorkspacePath); const remotePath = getUriFilePath(config.remoteWorkspacePath); -function getUriFilePath(path: string|undefined): string { - return path ? vscode.Uri.file(path).toString() : ''; +function getUriFilePath(path: string | undefined): string { + return path ? vscode.Uri.file(path).toString() : ""; } /** @@ -22,9 +22,7 @@ export const mapFromWorkspaceUri = (file: vscode.Uri): string => { if (!config.remoteEnabled || !config.remoteWorkspacePath) { return file.toString(); } - return file - .toString() - .replace(localPath, remotePath); + return file.toString().replace(localPath, remotePath); }; /** @@ -35,10 +33,7 @@ export const mapFromWorkspaceUri = (file: vscode.Uri): string => { export const mapToWorkspaceUri = (file: string): vscode.Uri => { let filePath = file; if (config.remoteEnabled && config.remoteWorkspacePath) { - filePath = filePath.replace( - remotePath, - localPath - ); + filePath = filePath.replace(remotePath, localPath); } if (filePath.startsWith("file://")) { return vscode.Uri.parse(filePath); diff --git a/src/coveragechecker.ts b/src/coveragechecker.ts index ccd2ee2..e3598bf 100644 --- a/src/coveragechecker.ts +++ b/src/coveragechecker.ts @@ -21,33 +21,32 @@ export class HackCoverageChecker { constructor(languageClient: LanguageClient) { this.coverageStatus = vscode.window.createStatusBarItem( - vscode.StatusBarAlignment.Left - ); - this.hhvmCoverDiag = vscode.languages.createDiagnosticCollection( - "hack_coverage" + vscode.StatusBarAlignment.Left, ); + this.hhvmCoverDiag = + vscode.languages.createDiagnosticCollection("hack_coverage"); this.languageClient = languageClient; } public async start(context: vscode.ExtensionContext) { context.subscriptions.push( - vscode.workspace.onDidSaveTextDocument(async doc => this.check(doc)) + vscode.workspace.onDidSaveTextDocument(async (doc) => this.check(doc)), ); context.subscriptions.push( - vscode.window.onDidChangeActiveTextEditor(async editor => { + vscode.window.onDidChangeActiveTextEditor(async (editor) => { if (editor) { await this.check(editor.document); } else { this.hhvmCoverDiag.clear(); this.coverageStatus.hide(); } - }) + }), ); context.subscriptions.push( vscode.commands.registerCommand( "hack.toggleCoverageHighlight", - async () => this.toggle() - ) + async () => this.toggle(), + ), ); context.subscriptions.push(this.hhvmCoverDiag, this.coverageStatus); @@ -79,13 +78,16 @@ export class HackCoverageChecker { let coverageResponse: TypeCoverageResponse; try { - coverageResponse = await this.languageClient.sendRequest< - TypeCoverageResponse - >("textDocument/typeCoverage", { - textDocument: this.languageClient.code2ProtocolConverter.asTextDocumentIdentifier( - document - ) - }); + coverageResponse = + await this.languageClient.sendRequest( + "textDocument/typeCoverage", + { + textDocument: + this.languageClient.code2ProtocolConverter.asTextDocumentIdentifier( + document, + ), + }, + ); } catch (e) { this.coverageStatus.hide(); return; @@ -98,11 +100,11 @@ export class HackCoverageChecker { if (this.visible && coverageResponse.uncoveredRanges) { const diagnostics: vscode.Diagnostic[] = []; - coverageResponse.uncoveredRanges.forEach(uncoveredRange => { + coverageResponse.uncoveredRanges.forEach((uncoveredRange) => { const diagnostic = new vscode.Diagnostic( uncoveredRange.range, uncoveredRange.message || coverageResponse.defaultMessage, - vscode.DiagnosticSeverity.Information + vscode.DiagnosticSeverity.Information, ); diagnostic.source = "Type Coverage"; diagnostics.push(diagnostic); diff --git a/src/debugger.ts b/src/debugger.ts index 846bae0..378e211 100644 --- a/src/debugger.ts +++ b/src/debugger.ts @@ -93,7 +93,7 @@ class HHVMDebuggerWrapper { private attachTarget( attachMessage: DebugProtocol.AttachRequest, - retries: number = 0 + retries: number = 0, ) { const args: HhvmAttachRequestArguments = attachMessage.arguments; const attachPort = args.port @@ -133,7 +133,7 @@ class HHVMDebuggerWrapper { event: "hhvmConnectionDied", }); process.stderr.write( - "The connection to the debug target has been closed." + "The connection to the debug target has been closed.", ); process.exit(0); }); @@ -144,7 +144,7 @@ class HHVMDebuggerWrapper { if (this.localWorkspaceRootPattern && this.remoteSiteRoot) { mappedData = mappedData.replace( this.localWorkspaceRootPattern, - this.remoteSiteRoot + this.remoteSiteRoot, ); } @@ -166,7 +166,7 @@ class HHVMDebuggerWrapper { socket.on("error", (error) => { if (retries >= 5) { process.stderr.write( - `Error communicating with debugger target: ${error.toString()}\n` + `Error communicating with debugger target: ${error.toString()}\n`, ); process.exit((error).code); } else { @@ -226,8 +226,8 @@ class HHVMDebuggerWrapper { scriptArgs = scriptArgs.map((value) => value.replace( args.localWorkspaceRoot || "", - args.remoteWorkspacePath || "" - ) + args.remoteWorkspacePath || "", + ), ); this.remoteSiteRoot = args.remoteWorkspacePath; @@ -266,7 +266,7 @@ class HHVMDebuggerWrapper { // Exit with the same error code the target exits with. targetProcess.on("exit", (code) => process.exit(code || undefined)); targetProcess.on("error", (error) => - process.stderr.write(`${error.toString()}\n`) + process.stderr.write(`${error.toString()}\n`), ); // Wrap any stdout from the target into a VS Code stdout event. @@ -298,7 +298,7 @@ class HHVMDebuggerWrapper { if (this.localWorkspaceRootPattern && this.remoteSiteRoot) { mappedData = mappedData.replace( this.localWorkspaceRootPattern, - this.remoteSiteRoot + this.remoteSiteRoot, ); } @@ -513,7 +513,7 @@ class HHVMDebuggerWrapper { this.writeOutputWithHeader(obj); } catch (e: any) { process.stderr.write( - `Error parsing message from target: ${e.toString()}: ${message}\n` + `Error parsing message from target: ${e.toString()}: ${message}\n`, ); } @@ -704,7 +704,7 @@ class HHVMDebuggerWrapper { if (this.remoteSiteRootPattern && this.localWorkspaceRoot) { output = output.replace( this.remoteSiteRootPattern, - this.localWorkspaceRoot + this.localWorkspaceRoot, ); } diff --git a/src/main.ts b/src/main.ts index 8c12890..e258a9e 100755 --- a/src/main.ts +++ b/src/main.ts @@ -26,12 +26,15 @@ export async function activate(context: vscode.ExtensionContext) { return; } - await vscode.window.withProgress({ - location: vscode.ProgressLocation.Window, - title: `Running Hack typechecker` - }, async () => { - return hh_client.start(); - }); + await vscode.window.withProgress( + { + location: vscode.ProgressLocation.Window, + title: `Running Hack typechecker`, + }, + async () => { + return hh_client.start(); + }, + ); const services: Promise[] = []; services.push(LSPHHASTLint.START_IF_CONFIGURED_AND_ENABLED(context)); @@ -44,7 +47,7 @@ export async function activate(context: vscode.ExtensionContext) { vscode.debug.registerDebugConfigurationProvider( "hhvm", - new HhvmDebugConfigurationProvider() + new HhvmDebugConfigurationProvider(), ); await Promise.all(services); diff --git a/src/providers.ts b/src/providers.ts index 265dff9..d772b0a 100644 --- a/src/providers.ts +++ b/src/providers.ts @@ -15,22 +15,22 @@ const symbolArray = [ { key: "interface", value: vscode.SymbolKind.Interface }, { key: "enum", value: vscode.SymbolKind.Enum }, { key: "trait", value: vscode.SymbolKind.Interface }, - { key: "property", value: vscode.SymbolKind.Property } + { key: "property", value: vscode.SymbolKind.Property }, ]; const symbolMap = new Map( - symbolArray.map<[string, vscode.SymbolKind]>(x => [x.key, x.value]) + symbolArray.map<[string, vscode.SymbolKind]>((x) => [x.key, x.value]), ); const getRange = ( lineStart: number, lineEnd: number, charStart: number, - charEnd: number + charEnd: number, ): vscode.Range => { return new vscode.Range( new vscode.Position(lineStart - 1, charStart - 1), - new vscode.Position(lineEnd - 1, charEnd - 1) + new vscode.Position(lineEnd - 1, charEnd - 1), ); }; @@ -42,9 +42,9 @@ const pushSymbols = ( outline: OutlineResponse[], symbols: vscode.SymbolInformation[], container: string, - indent: string + indent: string, ) => { - outline.forEach(element => { + outline.forEach((element) => { let name = element.name; const nameIndex = name.lastIndexOf("\\"); if (nameIndex !== -1) { @@ -68,7 +68,7 @@ const pushSymbols = ( element.span.line_start, element.span.line_end, element.span.char_start, - element.span.char_end + element.span.char_end, ); symbols.push( new vscode.SymbolInformation( @@ -76,8 +76,8 @@ const pushSymbols = ( symbolKind, range, undefined, - container - ) + container, + ), ); // Check if element has any children, and recursively fetch them as well. @@ -91,7 +91,7 @@ const pushSymbols = ( export class HackHoverProvider implements vscode.HoverProvider { public provideHover( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): vscode.ProviderResult { const wordPosition = document.getWordRangeAtPosition(position); if (!wordPosition) { @@ -102,7 +102,7 @@ export class HackHoverProvider implements vscode.HoverProvider { const character: number = startPosition.character + 1; return hh_client .typeAtPos(utils.mapFromWorkspaceUri(document.uri), line, character) - .then(hoverType => { + .then((hoverType) => { if (!hoverType) { return; } @@ -111,7 +111,7 @@ export class HackHoverProvider implements vscode.HoverProvider { } const formattedMessage: vscode.MarkedString = { language: "hack", - value: hoverType + value: hoverType, }; return new vscode.Hover(formattedMessage); }); @@ -119,11 +119,12 @@ export class HackHoverProvider implements vscode.HoverProvider { } export class HackDocumentSymbolProvider - implements vscode.DocumentSymbolProvider { + implements vscode.DocumentSymbolProvider +{ public provideDocumentSymbols( - document: vscode.TextDocument + document: vscode.TextDocument, ): vscode.ProviderResult { - return hh_client.outline(document.getText()).then(outline => { + return hh_client.outline(document.getText()).then((outline) => { const symbols: vscode.SymbolInformation[] = []; pushSymbols(outline, symbols, "", ""); return symbols; @@ -132,13 +133,14 @@ export class HackDocumentSymbolProvider } export class HackWorkspaceSymbolProvider - implements vscode.WorkspaceSymbolProvider { + implements vscode.WorkspaceSymbolProvider +{ public provideWorkspaceSymbols( - query: string + query: string, ): vscode.ProviderResult { - return hh_client.search(query).then(searchResult => { + return hh_client.search(query).then((searchResult) => { const symbols: vscode.SymbolInformation[] = []; - searchResult.forEach(element => { + searchResult.forEach((element) => { const name = element.name.split("\\").pop() || ""; let desc = element.desc; if (desc.includes(" in ")) { @@ -155,10 +157,10 @@ export class HackWorkspaceSymbolProvider element.line, element.line, element.char_start, - element.char_end + element.char_end, ); symbols.push( - new vscode.SymbolInformation(name, kind, range, uri, container) + new vscode.SymbolInformation(name, kind, range, uri, container), ); }); return symbols; @@ -167,20 +169,21 @@ export class HackWorkspaceSymbolProvider } export class HackDocumentHighlightProvider - implements vscode.DocumentHighlightProvider { + implements vscode.DocumentHighlightProvider +{ public provideDocumentHighlights( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): vscode.ProviderResult { return hh_client .ideHighlightRefs( document.getText(), position.line + 1, - position.character + 1 + position.character + 1, ) - .then(highlightResult => { + .then((highlightResult) => { const highlights: vscode.DocumentHighlight[] = []; - highlightResult.forEach(element => { + highlightResult.forEach((element) => { const line: number = element.line - 1; const charStart: number = element.char_start - 1; const charEnd: number = element.char_end; @@ -188,10 +191,10 @@ export class HackDocumentHighlightProvider new vscode.DocumentHighlight( new vscode.Range( new vscode.Position(line, charStart), - new vscode.Position(line, charEnd) + new vscode.Position(line, charEnd), ), - vscode.DocumentHighlightKind.Text - ) + vscode.DocumentHighlightKind.Text, + ), ); }); return highlights; @@ -200,16 +203,17 @@ export class HackDocumentHighlightProvider } export class HackCompletionItemProvider - implements vscode.CompletionItemProvider { + implements vscode.CompletionItemProvider +{ public provideCompletionItems( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): vscode.ProviderResult { return hh_client .autoComplete(document.getText(), document.offsetAt(position)) - .then(completionResult => { + .then((completionResult) => { const completionItems: vscode.CompletionItem[] = []; - completionResult.forEach(element => { + completionResult.forEach((element) => { let label: string = element.name.split("\\").pop() || ""; let labelType: string = element.type; let kind = vscode.CompletionItemKind.Class; @@ -241,21 +245,22 @@ export class HackCompletionItemProvider } export class HackDocumentFormattingEditProvider - implements vscode.DocumentFormattingEditProvider { + implements vscode.DocumentFormattingEditProvider +{ public provideDocumentFormattingEdits( - document: vscode.TextDocument + document: vscode.TextDocument, ): vscode.ProviderResult { const text: string = document.getText(); - return hh_client.format(text, 0, text.length).then(formatResult => { + return hh_client.format(text, 0, text.length).then((formatResult) => { if (formatResult.internal_error || formatResult.error_message) { return; } const textEdit = vscode.TextEdit.replace( new vscode.Range( document.positionAt(0), - document.positionAt(text.length) + document.positionAt(text.length), ), - formatResult.result + formatResult.result, ); return [textEdit]; }); @@ -265,33 +270,33 @@ export class HackDocumentFormattingEditProvider export class HackReferenceProvider implements vscode.ReferenceProvider { public provideReferences( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): vscode.ProviderResult { const text = document.getText(); return hh_client .ideFindRefs(text, position.line + 1, position.character + 1) - .then(foundRefs => { + .then((foundRefs) => { return hh_client .ideHighlightRefs(text, position.line + 1, position.character + 1) - .then(highlightRefs => { + .then((highlightRefs) => { const locations: vscode.Location[] = []; - foundRefs.forEach(ref => { + foundRefs.forEach((ref) => { const location = new vscode.Location( utils.mapToWorkspaceUri(ref.filename), new vscode.Range( new vscode.Position(ref.line - 1, ref.char_start - 1), - new vscode.Position(ref.line - 1, ref.char_end) - ) + new vscode.Position(ref.line - 1, ref.char_end), + ), ); locations.push(location); }); - highlightRefs.forEach(ref => { + highlightRefs.forEach((ref) => { const location = new vscode.Location( vscode.Uri.file(document.fileName), new vscode.Range( new vscode.Position(ref.line - 1, ref.char_start - 1), - new vscode.Position(ref.line - 1, ref.char_end) - ) + new vscode.Position(ref.line - 1, ref.char_end), + ), ); locations.push(location); }); @@ -304,14 +309,14 @@ export class HackReferenceProvider implements vscode.ReferenceProvider { export class HackDefinitionProvider implements vscode.DefinitionProvider { public provideDefinition( document: vscode.TextDocument, - position: vscode.Position + position: vscode.Position, ): vscode.ProviderResult { const text = document.getText(); return hh_client .ideGetDefinition(text, position.line + 1, position.character + 1) - .then(foundDefinition => { + .then((foundDefinition) => { const definition: vscode.Location[] = []; - foundDefinition.forEach(element => { + foundDefinition.forEach((element) => { if (element.definition_pos) { const location: vscode.Location = new vscode.Location( element.definition_pos.filename @@ -320,13 +325,13 @@ export class HackDefinitionProvider implements vscode.DefinitionProvider { new vscode.Range( new vscode.Position( element.definition_pos.line - 1, - element.definition_pos.char_start - 1 + element.definition_pos.char_start - 1, ), new vscode.Position( element.definition_pos.line - 1, - element.definition_pos.char_end - ) - ) + element.definition_pos.char_end, + ), + ), ); definition.push(location); } diff --git a/src/proxy.ts b/src/proxy.ts index ba315a7..be77c60 100755 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -25,7 +25,7 @@ export async function check(): Promise { export async function typeAtPos( fileName: string, line: number, - character: number + character: number, ): Promise { const arg: string = `${fileName}:${line}:${character}`; const args: string[] = ["--type-at-pos", arg]; @@ -54,7 +54,7 @@ export async function search(query: string): Promise { export async function ideFindRefs( text: string, line: number, - character: number + character: number, ): Promise { return run(["--ide-find-refs", `${line}:${character}`], text); } @@ -62,7 +62,7 @@ export async function ideFindRefs( export async function ideHighlightRefs( text: string, line: number, - character: number + character: number, ): Promise { return run(["--ide-highlight-refs", `${line}:${character}`], text); } @@ -70,19 +70,19 @@ export async function ideHighlightRefs( export async function ideGetDefinition( text: string, line: number, - character: number + character: number, ): Promise { return run(["--ide-get-definition", `${line}:${character}`], text); } export async function autoComplete( text: string, - position: number + position: number, ): Promise { // Insert hh_client autocomplete token at cursor position. const autoTok: string = "AUTO332"; const input = [text.slice(0, position), autoTok, text.slice(position)].join( - "" + "", ); return run(["--auto-complete"], input); } @@ -90,7 +90,7 @@ export async function autoComplete( export async function format( text: string, startPos: number, - endPos: number + endPos: number, ): Promise { // `endPos` is incremented to stop `hh_client --format` from removing the // final character when there is no newline at the end of the file. @@ -134,7 +134,7 @@ async function run(extraArgs: string[], stdin?: string): Promise { console.error(`Hack: hh_client output error: ${parseErr}`); resolve(null); } - } + }, ); if (stdin && p && p.stdin) { p.stdin.write(stdin);