Giter Site home page Giter Site logo

slackhq / vscode-hack Goto Github PK

View Code? Open in Web Editor NEW
73.0 78.0 36.0 1.04 MB

Hack language & HHVM debugger support for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=pranayagarwal.vscode-hack

License: MIT License

TypeScript 88.77% JavaScript 4.26% Hack 6.97%
hack hhvm visual-studio-code vscode vscode-extension hacklang php

vscode-hack's People

Contributors

auchenberg avatar azjezz avatar beatscode avatar beefsack avatar dependabot[bot] avatar fredemmott avatar glitched avatar lexidor avatar lildude avatar panopticoncentral avatar pchaigno avatar pranayagarwal avatar scotchval avatar skoro avatar tspence avatar wilfred avatar yucombinator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-hack's Issues

[improvement] better auto-complete / suggestions

  1. autocomplete symbols from all namespaces, while suggesting the nearest symbols fist.
  2. autocomplete method/function parameter type with classnames, builtin types, type aliases, type definitions, and other "classish" symbols from all namespaces, while suggesting the nearest symbols fist.
  3. autocomplete extends | / require extends | with classes / abstract classes ( no final classes should be suggested ) from all namespaces, while suggesting the nearest symbols fist.
  4. autocomplete implements | / require implements | with interfaces from all namespaces, while suggesting the nearest symbols fist.
  5. autocomplete uses | with traitnames from all namespaces, while suggesting the nearest symbols fist.
  6. autocomplete type definition ( e.g : type foo = | ) with builtin types, classish symbols, type definitions from all namespaces, while suggesting the builtin types first, followed by the nearest symbols.
  7. autocomplete variables ( e.g foo($| ) with variables form the current scoop first, followed by variables from the parent scoop if applicable ( e.g : inside a block, that being an async block or lambda body. while inside concurrent block, local scoop variables should not be suggested. )
  8. suggest only variables with same type as right expression when dealing with strict compression ( e.g : $string === $| )
  9. only suggest variables of type bool when dealing with boolean operators ( e.g $a || $| )
  10. only suggest variables of type num when dealing with mathematical operators ( e.g $a + $| )

Some of the features request above work perfectly when working on the global namespace, but as soon as namespaces are involved, the DX is not as pleasant.

note : | in the given samples refers to the cursor position.

Autocomplete not working

Hello,

I recently installed vscode-hack but I can't get the autocomplete working the same way it is shown in the plugging readme. When I right click in the code I can't see the Go to definition option.

I am using:

  • windows 10 (sadly)
  • vscode 1.33.0
  • hhvm 3.24.8
  • hh_client 3.24.8
  • web server nginx
  • and everything is running in vagrant

I tried the configuration for remote development without success. (See below)

    "hack.remote.enabled": true,
    "hack.remote.type": "ssh",
    "hack.remote.ssh.host": "ssh [email protected] -p 2222 \"cd /vagrant/webroot && /usr/bin/hh_client\" ",

I also executed succesfully ssh [email protected] -p 2222 "cd /vagrant/webroot && /usr/bin/hh_client as recommended.

Looking forward to hearing from you,
Cheers,

Sam


ps: Here is my full settings.json:

{
    "window.enableMenuBarMnemonics": false,
    "window.zoomLevel": 0,
    "window.openFilesInNewWindow": "on",

    "workbench.editor.enablePreviewFromQuickOpen": false,
    "workbench.colorTheme": "Darcula Extended",
    "workbench.editor.tabSizing": "shrink",
    "workbench.colorCustomizations" : {
        "terminal.foreground" : "#00A20E",
        "terminal.background" : "#080808"
    },

    "explorer.autoReveal": false,
    "explorer.confirmDelete": false,

    "editor.renderWhitespace": "all",
    "editor.renderIndentGuides": true,
    "editor.renderLineHighlight": "all",
    "editor.largeFileOptimizations": false,
    "editor.suggestSelection": "first",
    "editor.quickSuggestions": {
      "other": true,
      "comments": true,
      "strings": true
    },

    "terminal.integrated.shell.windows": "cmd.exe",
    "terminal.integrated.shellArgs.windows": [
        "/k", "C:\\Users\\Samy\\cmder\\vendor\\init.bat"
    ],

    "files.insertFinalNewline": true,
    "files.trimTrailingWhitespace": true,
    "files.associations": {
      "*.php": "hack"
    } ,

    //check php version
    // "php.validate.executablePath": "[email protected] -p 2222 \"cd /usr/bin/php\"",
    // "php.validate.executablePath": "C:\\Users\\Samy\\dev\\php\\php-5.6.40\\php.exe",
    // "php.validate.executablePath": "C:\\Users\\Samy\\dev\\php\\php-7.0.33\\php.exe",
    // "php.suggest.basic": false,
    // "php-docblocker.qualifyClassNames": true,
    // "php-docblocker.returnGap": true,
    // "phpformatter.composer": true,

    // "phpcs.executablePath": "C:\\Users\\Samy\\dev\\php\\phpcs\\phpcs.phar",
    // "phpcs.standard": "PSR2",
    // "phpcs.ignorePatterns": [
    //   "/database/*",
    //   "/tests/*",
    //   "/app/Http/Routes/*",
    // ],

    "hack.remote.enabled": true,
    "hack.remote.type": "ssh",
    "hack.remote.ssh.host": "ssh [email protected] -p 2222 \"cd /vagrant/webroot && /usr/bin/hh_client\" ",
    //"hack.remote.workspacePath": "",

    "git.enableSmartCommit": true,
    "git.ignoreLegacyWarning": true,

    "gitlens.codeLens.enabled": false,
    "gitlens.advanced.messages": {
        "suppressGitVersionWarning": true,
        "suppressShowKeyBindingsNotice": true,
        "suppressResultsExplorerNotice": true,
        "suppressWelcomeNotice": true
    },
    "gitlens.keymap": "chorded",
    //"gitlens.historyExplorer.enabled": true,
    "gitlens.hovers.currentLine.over": "line",
    "gitlens.views.fileHistory.enabled": true,
    "gitlens.views.lineHistory.enabled": true,

    "prettier.printWidth": 120,
    "prettier.singleQuote": true,
    "prettier.tabWidth": 4,
    // "[php]": {
    //   "editor.rulers": [120],
    // },
    "[html]": {
      "editor.rulers": [120],
    },
    "[css]": {
      "editor.rulers": [120],
    },
    "[less]": {
      "editor.rulers": [120],
    },
    "[scss]": {
      "editor.rulers": [120],
    },
    "[javascript]": {
      "editor.rulers": [120],
    },

    "projects.refreshIgnoreFolders": [
      "bower_components",
      "node_modules",
      "typings",
      ".vscode",
      ".vagrant",
      ".docker",
      "nbprojects",
    ],
    "projects.viewAllEnabled": true,
    "projects.checkDirty": true,
    "projects.checkPaths": true,

    "breadcrumbs.enabled": true,

    "workbench.iconTheme": "vscode-icons"
}

Extension is not responding after installation

I've been trying to get the extension to work like your readme screen share. The only thing that seems to happen is the Hack Language Extension is available but, adding invalid syntax or hovering over function calls are responsive. I also don't see the code coverage percentage in the footer section. I've tried setting the hack.clientPath and no difference. I disabled all extensions besides this and nothing as well.
Im using a mac book pro with Sierra 10.12.5. I've installed hhvm 3.20 via homebrew.
hhvm --version
309eb009-0491-4ba9-bc51-7359a847f4d5

Any suggestions

maintenance plans

Hi,

I know probably this is not the place for this question but I don't know where to ask.

So, will this plugin be maintained in the future?
will slack keep working with hacklang even though the end of the php support?

"Variables" pane broken in debugger

"An internal error occurred while processing a debugger command"

Inspecting variables from the debug console works fine

Using HHVM 4.62 on MacOS Catalina

Enable Hack language server with .hhconfig not in root

I have a repository that uses a few different programming languages and in order to keep things clean I put the dotfiles to support each language in the folder containing that language's code.

It seems like this extension only supports .hhconfig in the root of the workspace. Would it be possible to support workspaceContains:**/.hhconfig? Or alternatively to add onLanguage:hack to activationEvents?

I'm willing to write and test a Pull Request if this would be an acceptable change?

[Syntax highlighting] Error in endCaptures pattern in type-annotation in v2.7.0

๐Ÿ‘‹ I'm the lead maintainer of https://github.com/github/linguist which uses this grammar for syntax highlighting of Hack files on GitHub.com.

I'm in the process of making a new release and our grammar compiler has detected an error in your grammar that was introduced in #72:

'Repository[type-annotation].Patterns[3].EndCaptures[1]' expected a map, got 'string'

The error is because the first, and only, endCaptures in the fourth pattern of type-annotation is a string:

          "endCaptures": {
            "1": "keyword.operator.key.php"
          },

It should be a map, ie:

          "endCaptures": {
            "1": {
              "name": "keyword.operator.key.php"
            }
          },

PR coming up.

[Syntax Highlighting] Invalid unicode regex match

As with #76, our grammar compiler has found another error introduced in #72. This time it's an invalid unicode regex match:

Invalid regex in grammar: `source.hack` (in `syntaxes/hack.json`) contains a malformed regex (regex "`(?xi)([a-z_\x{7f}-\x{7fffffff}]`...": character value in \x{} or \o{} is too large (at offset 30))

... and ...

Invalid regex in grammar: `source.hack` (in `syntaxes/hack.json`) contains a malformed regex (regex "`(?i)[a-z_\x{7f}-\x{7fffffff}][a-`...": character value in \x{} or \o{} is too large (at offset 27))

The line numbers have been truncated. but they correspond to...

"match": "(?xi)\n([a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*) # Exception class\n((?:\\s*\\|\\s*[a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*)*) # Optional additional exception classes\n\\s*\n((\\$+)[a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*) # Variable",

... and ...

"match": "(?i)[a-z_\\x{7f}-\\x{7fffffff}][a-z0-9_\\x{7f}-\\x{7fffffff}]*",

... respectively.

I suspect the intent here was to cover all unicode chars from 0x7F to the end, however 0x7FFFFFFF is no longer a valid UTF-8 unicode char. As of 2003, the max is 0x10FFFF.

From https://en.wikipedia.org/wiki/UTF-8#History:

In November 2003, UTF-8 was restricted by RFC 3629 to match the constraints of the UTF-16 character encoding: explicitly prohibiting code points corresponding to the high and low surrogate characters removed more than 3% of the three-byte sequences, and ending at U+10FFFF removed more than 48% of the four-byte sequences and all five- and six-byte sequences.

PR coming up to implement this change.

Syntax highlighting of User Attributes is inconsistent

namespace Cast;
<<Lossy, Safe>>
//purple ^^^^
function num_int_round(num $num): int {
	return $num is int ? $num : float_int_round($num as float);
}
namespace Cast;
<<Safe>>
function num_int_round(num $num): int {
	return $num is int ? $num : float_int_round($num as float);
}

[Likely External | Autocomplete] Method calls autocomplete with an extra argument list

Copy of issue

facebook/hhvm#8589

HHVM Version

HipHop VM 4.28.0 (rel)
Compiler: 1571678629_197174034
Repo schema: c1068de11223e85fa6f517d694c9df37c23b7732

code --version
1.39.2
6ab598523be7a800d7f3eb4d92d7ab9a66069390
x64

Name: Hack
Id: pranayagarwal.vscode-hack
Description: Hack language & HHVM debugger support for Visual Studio Code
Version: 2.7.0
Publisher: Pranay Agarwal
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=pranayagarwal.vscode-hack

Operating System and Version

Ubuntu 18.04

Standalone code, or other way to reproduce the problem

class SomeClass {
    public function someMethod(int $_1, int $_2): void {}
}

function main(): void {
    $some_class = new SomeClass();
    $some_class->s <--
}

Actual result

class SomeClass {
    public function someMethod(int $_1, int $_2): void {}
}

function main(): void {
    $some_class = new SomeClass();
    $some_class->someMethod()(, )
}

Expected result

class SomeClass {
    public function someMethod(int $_1, int $_2): void {}
}

function main(): void {
    $some_class = new SomeClass();
    $some_class->someMethod(, )
}

Debugger support?

Would love to see VSCode's debugger work with HHVM. I'm willing to help but have no idea where to start.

I've tried getting xdebug debugging working in HHVM and failed, but I did have success with HHVM's built-in debugger--although it was a pain to use. Integrating that with VSCode would be a dream...

No way to provide arguments for after `lsp`

hh_client makes a distinction between global options and per-command options. For example, hh_client --enhanced-hover lsp is invalid, but hh_client lsp --enhanced-hover is valid

Autocomplete falls back to vscode default

Given these two files, autocomplete does not kick in.

ClassnameFoo.hack
class ClassnameFoo{
    public function bar(): void{}
}
example.hack
function doSomething(ClassnameFoo $foo): void{
    $foo-> //autocomplete this
}

The suggestions on pressing ctrl+space at the arrow are: 'ClassnameFoo', 'doSomething', 'foo', 'function', and 'void'

Expected result

bar() //ClassnameFoo::bar(): void

Commands ran within the integrated terminal: hh_client
Result from hh_client: src/example.hack:2:11,11: A name or variable name is expected here. (Parsing[1002])

System info:

hhvm --version
HipHop VM 4.0.2 (rel)
Compiler: 1550605031_606999898
Repo schema: a46021ba5e51d676a396f711ef442e334fa9152a

hh_client --version
hh--4.0.2 Tue Feb 19 20:40:27 2019

vscode-hack
Name: Hack
Id: pranayagarwal.vscode-hack
Description: Hack language & HHVM debugger support for Visual Studio Code
Version: 1.2.1
Publisher: Pranay Agarwal
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=pranayagarwal.vscode-hack

[Syntax highlighting] New syntax highlighting in v2.7.0 does not handle this case.

Using the older version (and what github appears to be using)

  const dict<string, (function(Webserver\RequestURL): Awaitable<void>)> CONSTANT_NAME = dict[];
//00000 000012222221 33333333333333333333333333333333 33333333333333330 4444444444444 0 0000111

In case github updates their version before you had a chance to see it, this is what I see right now.

0 -> red
1 -> black
2 -> green
3 -> purple
4 -> blue

Using the newer version (2.7.0)

image

The comma behind string is red.
The left angle bracket of the Awaitable is red, but the right one is gray.
The left paren of the (function) is blue, but the right one is gray.
The left angle bracket of the dict is gray, but the right one is white.

Add workspace symbol search

Integrate with VS Code workspace symbols API to provide fuzzy search results for a symbol throughout the project in the command bar.

Can't see how to get full error message

vscode is only showing me [Hack] Wrong type hint (17,42)

Nuclide and hh_client show me:

src/fbmarkdown/unparsed-blocks/Context.php:17:42,56: Wrong type hint (Typing[4110])
  src/fbmarkdown/unparsed-blocks/Context.php:17:26,38: This is an object of type Facebook\Markdown\UnparsedBlocks\BlockProducer
  src/fbmarkdown/unparsed-blocks/Context.php:27:5,15: It is incompatible with an object of type Facebook\Markdown\UnparsedBlocks\ListOfItems

Langserver fails to connect on windows with docker

Hi!
I tried to setup a development environment on Windows and running hhvm and hh_client in docker (Linux), unfortunately without luck.
Has anyone succeeded with similar setup? The diag log here is not really helpful as the lang server gracefully disconnects and after 3 tries the extension gives up.

Not working with SSH remote

Does this extension really work with ssh? I tried multiple versions and nothing happened in my editor -- no lint, no format, nothing.

My ssh and remote hh_client works fine though. I ran this test as suggested and I got output from hh_client

ubuntu@UbuntuDesktop:~$ ssh [email protected] "cd /home/ubuntu/git_root/www2 && hh_client"
/home/ubuntu/git_root/www2/index.php:4:18,21: Unbound name: nore (an object type) (Naming[2049])
/home/ubuntu/git_root/www2/index.php:4:25,28: Encountered unexpected token 'turn'. (Parsing[1002])

Maintain expand/collapse state of items in the variables panel when stepping through code in debug mode

When using the debugger, everything in the variables panel gets collapsed on every step. This is especially annoying when trying to examine a nested structure.

I had initially thought this was a default VS Code behavior, but according to microsoft/vscode#32199 the state is determined by the debug server itself. Can dig bit deeper into this and see if this can be fixed in the extension debug adapter or by HHVM.

replace JSON HHAST support with LSP support

Should:

  • only run if $ROOT/vendor/bin/hhast-lint is present (or fail gracefully if it isn't)
  • be opt-in: this means that opening an editor is going to execute project-supplied code, and opening the editor should be safe
  • run hhast-lint --mode lsp --from vscode

Additionally, --json isn't going to be in a release

Extra quotation marks when completing shape fields

Hi,

When you are selection and option from the autocompletition list, vscode don't remove
the last '

Example:
if you have a shape with field message
$test['message'] = 'hello world';

then you are accessing that field, vscode automatically create the quotation mark for close.
$test['']

then you pick 'message' from the autocompletition list, the result is
$test['message'']

the problem is the double quotation mark to close.

Include error code in messages

Useful for adding HH_IGNORE_ERROR - eg hh_client shows:

Too few arguments (Typing[4104])

vscode just shows "Too few arguments"

If I know what I'm doing, I can add:

/* HH_IGNORE_ERROR[4104]  */
or
/* HH_FIXME[4104] */

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.