-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pragma after she-bang #1340
Add pragma after she-bang #1340
Conversation
Hi @Ailrun, sorry for the late reply. I have been trying to get
Any Ideas? |
What do you mean by "trying to get"? The code to retrieve |
Yes, the value of |
You mean even before your code? Your code does not change anything related with |
As far as I could check that happened before my code as well. Also, I couldn't figure out what problems a
this is the only place |
As I believe it surely works and disables some, so I just checked, and it properly disables P.S. There's nothing wrong with asking questions :) If my answers sound too hostile, I'm sorry. It's probably because I'm too busy right now... |
@Ailrun this is most of what I could conjure up. In theory, if |
@Ailrun what about now? Also, if this is done, please suggest me some other issues... |
then do | ||
contents <- LSP.getVirtualFileFunc lsp . toNormalizedUri $ docId ^. J.uri | ||
text <- pure $ fmap VFS.virtualFileText contents | ||
line <- pure . fromMaybe 0 $ findIndex (not . T.null) . take somh . T.lines =<< text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is when we have
#! /usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# LANGUAGE ScopedTypeVariables #-}
module AfterShebang where
foo :: forall a. a -> a
foo = id @a
we get
#! /usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module AfterShebang where
foo :: forall a. a -> a
foo = id @a
right? Then I have one question: Why do we need to check contents
? I notice that somh
itself is good enough...
Do you have any other cases that are not covered by somh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, this is why the tests fail. Current code actually gives
{-# LANGUAGE TypeApplications #-}
#! /usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# LANGUAGE ScopedTypeVariables #-}
module AfterShebang where
foo :: forall a. a -> a
foo = id @a
as it checks from the first line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not figure out the case for contents as well. I mostly copied from CodeAction.hs -> endOfModuleHeader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the somh
only but can't figure out why it still adds pragma to the first line. Sorry about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work in your local machine? GetParsedModuleWithComments errors probably come frome other tests, so could you check addPragma tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for being so patient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ailrun please let me know if I can help in anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm really busy for this week or two... maybe @jneira can also help? I'm not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jneira ... means a lot
83fab8a
to
833c6a8
Compare
The pr needs a rebase, i've try to do it here: ishmum123/haskell-language-server@bug-fix/pragma-before-shebang...jneira:pr1340 |
fa1af55
to
50bd268
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ishmum123 thanks for the patience and your work, here and indirectly in #1417
@jneira my pleasure... would be grateful if you could point to another issue |
@ishmum123 nice! there are some issues labeled with For example one that should be quite straightforward would be #1341 |
Remove warning about hlint restrictions, as haskell#1340 has been merged.
Remove warning about hlint restrictions, as #1340 has been merged. Co-authored-by: Michael Peyton Jones <[email protected]>
Draft PR for #555