hhvm / vim-hack Goto Github PK
View Code? Open in Web Editor NEWSyntax highlighting and typechecker integration for Hack.
License: MIT License
Syntax highlighting and typechecker integration for Hack.
License: MIT License
Hey there,
I recently built hh_client/hh_server on OS X and they seem to be working (though I'll be giving them a bit of a stress test over the coming days).
One thing I'd love would be being able to use vim-hack with them on OS X.
I'm running a fresh install of MacVim + VimBox[0], but after cloning the repository into ~/.vim/bundles/
and opening and saving a Hack file, it doesn't appear to be working.
Has anyone else got it running? Is it an incompatibility with VimBox/MacVim? Is it not picking up my symlinks (in /usr/local/bin/
)?
Cheers!
I believe this repo still has the old PATENTS file.
hh_client returns "No errors", but when I save the file I get the following trace:
Error detected while processing function hack#typecheck..<SNR>8_HackClientCall:
line 9:
E777: String or List expected
Press ENTER or type command to continue
I contstantly get: -- Omni completion (^O^N^P) Pattern not found
after I do Ctrl+x Ctrl+o
Part from my .vimrc
Bundle 'hhvm/vim-hack'
let g:hack#autoclose = 1
let g:hack#enable=1
filetype plugin on
set omnifunc=hackcomplete#Complete
Do I overlook something?
Ideally use hh_client --version --json
and use legacy approach if api_version < 5.
The neovim LanguageClient plugin also works happily on vim 8 - I'm using it with MacOS High Sierra's default vim with fredemmott/dotfiles@55054f2
In that setup, I'm basically just using this plugin for syntax highlighting, LSP for everything else.
When running :HackMake on file I get E118: Too many arguments for function: <SNR>24_JobExitHandler
. Is there a way to debug this..
I'm running Neovim on Mac OS Sierra 10.12.5
NVIM v0.2.1-40-g4c3d7b29
Build type: RelWithDebInfo
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20170508-5291-1ymt129/build/config -I/tmp/neovim-20170508-5291-1ymt129/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/usr/include -I/tmp/neovim-20170508-5291-1ymt129/build/src/nvim/auto -I/tmp/neovim-20170508-5291-1ymt129/build/include
Compiled by [email protected]
Optional features included (+) or not (-): +acl +iconv +jemalloc +tui
For differences from Vim, see :help vim-differences
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-4c3d7b2/share/nvim"
I removed a bunch of plugins in hopes to fix.
call plug#begin('~/.config/nvim/plugged')
"Git integration
Plug 'tpope/vim-fugitive'
"Plug 'leafgarland/typescript-vim'
"Plug 'Valloric/YouCompleteMe'
"Plug 'ryanoasis/vim-devicons'
Plug 'Shougo/deoplete.nvim'
Plug 'vim-airline/vim-airline'
"Ranger - Filesystem browsing
"Plug 'francoiscabrol/ranger.vim'
"Plug 'rbgrouleff/bclose.vim'
"VueJS support
"Plug 'posva/vim-vue'
"Plug 'joonty/vdebug'
Plug 'gioele/vim-autoswap'
"jsx
"Plug 'pangloss/vim-javascript'
"Plug 'mxw/vim-jsx'
"Hack
Plug 'hhvm/vim-hack'
"emmet
"Plug 'mattn/emmet-vim'
"AutoFormat
Plug 'Chiel92/vim-autoformat'
"For Searching Stuff
Plug 'rking/ag.vim'
"CtrlP for searching files
Plug 'ctrlpvim/ctrlp.vim'
"Plug 'tobyS/pdv'
"Plug 'tobyS/vmustache'
"Plug 'SirVer/ultisnips'
"Golang Integration
"Plug 'fatih/vim-go'
"Plug 'zchee/nvim-go', { 'do': 'make'}
"NerdTree
Plug 'scrooloose/nerdTree'
Plug 'Xuyuanp/nerdtree-git-plugin'
"Tagbar
Plug 'majutsushi/tagbar'
"Dash integration
Plug 'rizzatti/dash.vim'
"Theme
"Plug 'jacoborus/tender.vim'
"Plug 'mhartington/oceanic-next'
"Neomake
"Plug 'neomake/neomake'
"Plug 'mustache/vim-mustache-handlebars'
call plug#end()
As the coloring file is php.vim
, if hack is not used but plain old php, if using StanAngeloff's coloring (https://github.com/StanAngeloff/php.vim), it seems to erase that file.
I think this should not happen ; how about setting a brand new type (hence a new file) instead ?
Hello,
I noticed here: https://github.com/hhvm/vim-hack/blob/master/ftdetect/hack.vim#L14 that you set the syntax to be hack.
However, looking at vim syntaxes, I notice there is no hack.vim file.
Why not just set the syntax to be PHP?
Steps to reproduce:
function test() {
$a = 1;
}
Action: gg=G
to indent whole file
Expected Result: file should be indented properly
function test() {
$a = 1;
}
Actual:
function test() {
$a = 1;
}
However it works if we place the function in a php file like
<hh
function test() {
$a = 1;
}
I see that indent expression for hack is GetHackIndent
, which uses GetPhpIndent
under the hood. However, according to :h php-indent
, php indenting only works if PHP syntax is active. Maybe it's time to create an index expression dedicated to Hack?
When using ReflectionClass inside of a Hack class I am getting the following error in vim:
example.php|6 col 18 error| Unbound name: ReflectionClass
The code in question:
<?hh // strict
class Foo {
public function bar(string $baz) : void
{
if (class_exists($baz)) {
$foo = new \ReflectionClass($baz);
}
}
}
I get this error after installing the plugin with Vundle:
no such highlight group name: phpInterfaces
Any ideas what the issue could be?
git clone for git://github.com/hhvm/vim-hack.git doesn't work I think it should be git clone [email protected]/hhvm/vim-hack.git
Hello! First off, this is awesome, like wow. What I was wondering was if it is expected that, if we change a type for, say, a function in one buffer, that we should not see that this causes errors in other files where that function is called.
For example:
# foo.php
<?hh // strict
function add(int $a, $int b): int{ ... }
# bar.php
<?hh
$val = add("a", "b");
In the above scenario, if I have bar.php
open in another buffer, I can see the error perfectly. But if add()
is called elsewhere in the codebase (or I happen to not have that file open), the only way to find out where this causes problems is by manually running hh_client
, right? It's not expected to see the error in bar.php
from the foo.php
buffer?
When writing scripts that should be called from within the shell, the syntax colouring feature of the vim-hack
plugin get's broken. This is probably due to the fact that such scripts need to have the following as their first line
#!/usr/bin/hhvm
So an example of this would be a hypothetical script called version
with the following lines:
#!/usr/bin/hhvm
<?hh
function printVersion(string $version) {
echo "Version: $version\n";
}
printVersion("1.0");
When opening this script inside vim
, the vim-hack
plugin colours it very differently from normal hack
files, only highlighting strings and leaving everything else uncoloured.
On neovim-0.2.0 (latest release), if you save a file with errors, when the quickfix window appears it is focused. It's irritating to have to constantly move back to the pane I was working in when there are errors.
The quickfix window should appear and not be focused (or this should be configurable).
Empty rcfile with only vim-hack installed. Save a php file with an error in it. (Note that this only happens when the quickfix window is first opened, subsequent saves don't do anything).
When tested in vim-7.4 I get the expected behavior.
neovim version: 0.2.0
vim version: 7.4
Hey there,
A key feature (while HHVM is broken on OS X) that would make Hack so much easier to work with is to take advantage of the client-server architecture the typechecker has.
Currently, I run HHVM in a Docker container (in a Boot2Docker VM) on an OS X host, and this works well enough (I can run the type checker through ssh
and get the output in the console). It would be amazing if vim-hack
could do the same: give it an SSH command that it will execute it's calls to hh_client
/hh_server
through.
Is this possible through Vim? I'm honestly unsure.
Sometimes when I save, the window at the bottom pops up very quickly, then immediately goes away and leaves me in a state of off-by-one in the parts that haven't redrawn yet. Doing a :redraw!
fixes it or scrolling the code out of view and then back works too.
If you try calling hackcomplete while in the middle of a line (e.g. for editing parameters in an existing function call), the completion fails. After digging a bit, it seems, that the character under the cursor gets appended to the hh_client call before the magic autocomplete token.
public function morty(): string {
return 'morty';
}
public function rick(): void {
json_encode($this->m);
}
Trying to complete $this->m
(having the cursor pointing at the )
) will fail, the string passed to hh_client looks like json_encode($this->)mAUTO332;
If you remove the trailing );
, the completion will work as expected.
Imho, it should more look like json_encode($this->mAUTO332);
which correctly completes to $this->morty
.
I'm not very experienced in vimscript, but I have a solution and will create a pr.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.