vim-hack icon indicating copy to clipboard operation
vim-hack copied to clipboard

indentation not working if filetype=hack

Open blurrcat opened this issue 4 years ago • 1 comments

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?

blurrcat avatar Nov 10 '21 01:11 blurrcat

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.

zheltikov avatar Feb 19 '22 17:02 zheltikov