-
-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Extension pragma inserted below ghc options pragma (or shebang) no matter where it is in file #2364
Comments
Many thanks for the report and for working in fixing it. So i think add a regression test will be a must: there are already lot of them 😄 haskell-language-server/plugins/hls-pragmas-plugin/test/Main.hs Lines 29 to 55 in 07042d4
|
Finished writing a fix for this but there is a test that fails that I'm not sure is correct.
In this one it expects the pragma after the shebang lines but the shebang lines are after existing pragmas which makes them screwy to begin with since shebangs should be at the top of the file. So is this behaviour necessary? It's easy to change my implementation to match, but if the behaviour is not necessary it's better to delete the test. |
hi @eddiemundo Thanks for the fix, I didn't think of the case of pragmas in the middle of the file. With the tests I was just trying different combinations to be sure it was added under the last file header pragma, but if your output makes sense and passes your new tests as well I'm sure it's ok to ignore this one. |
* new parser for stuff before first declaration * remove unused pragmas, modify haddock comment on parser * working but need to clean lots of little things and add more tests * uncomment completions functions and tests (was trying to see why the test timeout), merge textedits to get around lsp-test applying text edits in reverse order, inserting pragma between lines fixes, some tests * add line splitting tests, fix line splitting errors and among other things, add docs * change comments, add cpp for setting use_pos_prags bit in PState * add safeImportsOn to compat, fix ghc versions * fix compat * fix compat * fix compat 3 * fix compat 4 * fix compat 5 * fix test * fix compat 6 * add back some tests and investigate #2375 later Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
…askell#2392) * new parser for stuff before first declaration * remove unused pragmas, modify haddock comment on parser * working but need to clean lots of little things and add more tests * uncomment completions functions and tests (was trying to see why the test timeout), merge textedits to get around lsp-test applying text edits in reverse order, inserting pragma between lines fixes, some tests * add line splitting tests, fix line splitting errors and among other things, add docs * change comments, add cpp for setting use_pos_prags bit in PState * add safeImportsOn to compat, fix ghc versions * fix compat * fix compat * fix compat 3 * fix compat 4 * fix compat 5 * fix test * fix compat 6 * add back some tests and investigate haskell#2375 later Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
Steps to reproduce
Expected behaviour
The extension should be put after the last pragma at the top of the file somewhere before the module declaration.
Actual behaviour
The extension is inserted after the ghc options pragma (or shebang) in the middle of the file.
Working on a fix for this so that my fix for something else can work.
The text was updated successfully, but these errors were encountered: