vim-hack
vim-hack copied to clipboard
indentation not working if filetype=hack
Steps to reproduce:
- create new file "test.hack"
- add the following content
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?
I can confirm this issue. I have the same problem whenever I create any new code block in an existing file. For example when I add a new if block, it doesn't get properly indented.