dramforever/vscode-ghc-simple

Incorrect type is shown for "."

fuszenecker opened this issue · 2 comments

image

  • A workaround is available
  • A fix is written
  • A fix is released
  • The fixed version is on the marketplace.

  • Version of vscode-ghc-simple: 0.1.22
  • Version of VSCode: 1.45.0
  • Version of Haskell-related tools:
    • GHC: 8.10.1
    • Stack: N/A
    • Cabal: 3.2.0.0

Steps to reproduce

I have just created a quick example for Turtle, my expression was files = ls ".", when I moved the cursor over ".", the plugin said, it was (.) :: (b -> c) -> (a -> b) -> a -> c instead of String or [Char]. It seems as if the plugin showed the type of the . operator.

Probably, showing String or [Char] would be more appropriate.

Workspace

{-# LANGUAGE OverloadedStrings #-}

module Main where

import Turtle
import Data.Text

main :: IO ()
main = do
  putStrLn "Hello, Haskell!"
  view files

  let z = fmap (\x -> either toLower toUpper $ toText x) files

  view z
  where
    files = ls "."

GHC log

Nothing is wrong with compilation.

That's a bit tricky, since I don't think there's a way for extensions to get language information, so I can't actually know whether you are in a string without parsing Haskell (to some extent), which is actually one thing I've been trying to avoid.

The 'semantically correct' fix would be to display nothing since it's a :info and :doc lookup.

I hope the hover message contains enough information to be unambiguous that it's searching for (.). Leaving open in case of possible fix.

Hi,

No problem, it is a really lovely behavior :-) I don't think it happens frequently, I just observed that sometimes it does.

Thanks for the excellent plugin, this is definitely my favourite. It has been working seamlessly since I used it first time.