Skip to content
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

Haskell: Problem with autosuggestion #1845

Closed
Ja-rek opened this issue May 2, 2020 · 13 comments
Closed

Haskell: Problem with autosuggestion #1845

Ja-rek opened this issue May 2, 2020 · 13 comments

Comments

@Ja-rek
Copy link

Ja-rek commented May 2, 2020

Result from CocInfo

CocConfig
  {
    "tsserver.log": "normal",
    "tsserver.trace.server": "verbose",
    "suggest.noselect": false,
    "suggest.snippetIndicator": "►",
    "suggest.minTriggerInputLength": 2,
    "suggest.floatEnable": true,
    "suggest.enablePreview": true,
    "codeLens.enable": true,
    "languageserver": {
        "flow": {
        "command": "flow",
        "args": ["lsp"],
        "filetypes": ["javascript", "javascriptreact"],
        "initializationOptions": {},
        "requireRootPattern": true,
        "settings": {},
        "rootPatterns": [".flowconfig"]
      },
      "haskell": {
      "trace.server": "verbose",
      "command": "hie-wrapper",
      "args": ["--lsp"],
      "rootPatterns": [
        "stack.yaml",
        "cabal.config",
        "package.yaml"
      ],
      "filetypes": [
        "hs",
        "lhs",
        "haskell"
      ],
      "initializationOptions": {
        "languageServerHaskell": {
          "hlintOn": true,
          "completionSnippetsOn": true
        }
      }
    }
    }
  }

CocOpenLog 2020-05-02T16:57:06.040 INFO (pid:3814) [services] - registered service "languageserver.flow" 2020-05-02T16:57:06.042 INFO (pid:3814) [services] - registered service "languageserver.haskell" 2020-05-02T16:57:06.044 INFO (pid:3814) [services] - haskell state change: stopped => starting 2020-05-02T16:57:06.063 INFO (pid:3814) [services] - registered service "eslint" 2020-05-02T16:57:06.093 INFO (pid:3814) [language-client-index] - languageserver.haskell started with 3827 2020-05-02T16:57:06.103 INFO (pid:3814) [plugin] - coc 0.0.78-030aef2f6d initialized with node: v12.16.2 2020-05-02T16:57:06.718 INFO (pid:3814) [services] - haskell state change: starting => running 2020-05-02T16:57:06.726 INFO (pid:3814) [services] - service languageserver.haskell started 2020-05-02T16:57:11.515 INFO (pid:3814) [completion-complete] - Results from: around,word,snippets,languageserver.haskell 2020-05-02T16:57:38.678 INFO (pid:3814) [completion-complete] - Results from: around,word,snippets,languageserver.haskell
CocInfo ## versions

vim version: NVIM v0.4.3
node version: v12.16.2
coc.nvim version: 0.0.78-030aef2f6d
term: st-256color
platform: linux

Output channel: snippets

[Info 16:47:18] Using ultisnips directories: UltiSnips /home/jk/.config/coc/ultisnips
[Info 16:47:18] Using ultisnips python command: pyx

Output channel: languageserver.haskell

[Trace - 16:47:18] Sending request 'initialize - (0)'.
Params: {
"processId": 32531,
"rootPath": "/home/jk/craps/haskellls/myproj2",
"rootUri": "file:///home/jk/craps/haskellls/myproj2",
"capabilities": {
"workspace": {
"applyEdit": true,
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
],
"failureHandling": "textOnlyTransactional"
},
"didChangeConfiguration": {
"dynamicRegistration": true
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"symbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"executeCommand": {
"dynamicRegistration": true
},
"configuration": true,
"workspaceFolders": true
},
"textDocument": {
"publishDiagnostics": {
"relatedInformation": true,
"versionSupport": false
},
"synchronization": {
"dynamicRegistration": true,
"willSave": true,
"willSaveWaitUntil": true,
"didSave": true
},
"completion": {
"dynamicRegistration": true,
"contextSupport": true,
"completionItem": {
"snippetSupport": true,
"commitCharactersSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"deprecatedSupport": true,
"preselectSupport": true
},
"completionItemKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
},
"hover": {
"dynamicRegistration": true,
"contentFormat": [
"markdown",
"plaintext"
]
},
"signatureHelp": {
"dynamicRegistration": true,
"signatureInformation": {
"documentationFormat": [
"markdown",
"plaintext"
],
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"definition": {
"dynamicRegistration": true
},
"references": {
"dynamicRegistration": true
},
"documentHighlight": {
"dynamicRegistration": true
},
"documentSymbol": {
"dynamicRegistration": true,
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
}
},
"codeLens": {
"dynamicRegistration": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"onTypeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"typeDefinition": {
"dynamicRegistration": true
},
"implementation": {
"dynamicRegistration": true
},
"declaration": {
"dynamicRegistration": true
},
"colorProvider": {
"dynamicRegistration": true
},
"foldingRange": {
"dynamicRegistration": true,
"rangeLimit": 5000,
"lineFoldingOnly": true
},
"selectionRange": {
"dynamicRegistration": true
}
},
"window": {
"workDoneProgress": true
}
},
"initializationOptions": {
"languageServerHaskell": {
"hlintOn": true,
"completionSnippetsOn": true
}
},
"trace": "verbose",
"workspaceFolders": [
{
"uri": "file:///home/jk/craps/haskellls/myproj2",
"name": "myproj2"
}
],
"workDoneToken": "8494d282-fb91-4e25-84ae-f98acfbb61e1"
}

2020-05-02 16:47:18.174507733 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 1.3, Git revision 6dc7d4302b3dd644163a318d66a2cebd29e37b0b (3880 commits) x86_64 ghc-8.8.3
2020-05-02 16:47:18.174728714 [ThreadId 4] - Current directory:/home/jk/craps/haskellls/myproj2/app
2020-05-02 16:47:18.174878345 [ThreadId 4] - Operating system:linux
2020-05-02 16:47:18.174937756 [ThreadId 4] - args:["--lsp"]
2020-05-02 16:47:18.175264901 [ThreadId 4] - Module "/home/jk/craps/haskellls/myproj2/app/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/jk/craps/haskellls/myproj2", cradleOptsProg = CradleAction: Stack}
2020-05-02 16:47:18.175327286 [ThreadId 4] - Cradle directory:/home/jk/craps/haskellls/myproj2
2020-05-02 16:47:18.175495918 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-05-02 16:47:18.486606537 [ThreadId 4] - Project GHC version:8.8.3
2020-05-02 16:47:18.486737011 [ThreadId 4] - hie exe candidates :["hie-8.8.3","hie-8.8","hie"]
2020-05-02 16:47:18.486935175 [ThreadId 4] - found hie exe at:/home/jk/.local/bin/hie-8.8.3
2020-05-02 16:47:18.486995651 [ThreadId 4] - args:["--lsp"]
2020-05-02 16:47:18.487052638 [ThreadId 4] - launching ....

2020-05-02 16:47:18.489516742 [ThreadId 4] - Run entered for HIE(hie-8.8.3) Version 1.3, Git revision 6dc7d4302b3dd644163a318d66a2cebd29e37b0b (3880 commits) x86_64 ghc-8.8.3
2020-05-02 16:47:18.489881653 [ThreadId 4] - Operating as a LSP server on stdio
2020-05-02 16:47:18.490097969 [ThreadId 4] - Current directory:/home/jk/craps/haskellls/myproj2
2020-05-02 16:47:18.490195741 [ThreadId 4] - Operating system:linux
2020-05-02 16:47:18.490276964 [ThreadId 4] - args:["--lsp"]
2020-05-02 16:47:18.493005622 [ThreadId 4] - Module "/home/jk/craps/haskellls/myproj2/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/jk/craps/haskellls/myproj2", cradleOptsProg = CradleAction: Stack}
2020-05-02 16:47:18.493234704 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-05-02 16:47:18.788138075 [ThreadId 9] - Executing Stack GHC with args: --print-libdir
[Trace - 16:47:18] Received response 'initialize - (0)' in 613ms.
Result: {
"capabilities": {
"typeDefinitionProvider": true,
"foldingRangeProvider": false,
"textDocumentSync": {
"openClose": true,
"change": 2,
"willSave": false,
"willSaveWaitUntil": false,
"save": {
"includeText": false
}
},
"workspace": {},
"implementationProvider": true,
"documentRangeFormattingProvider": true,
"documentHighlightProvider": true,
"executeCommandProvider": {
"commands": [
"32563:applyrefact:applyOne",
"32563:applyrefact:applyAll",
"32563:generic:type",
"32563:ghcmod:check",
"32563:ghcmod:type",
"32563:ghcmod:casesplit",
"32563:hsimport:import",
"32563:package:add",
"32563:pragmas:addPragma"
]
},
"renameProvider": false,
"colorProvider": false,
"definitionProvider": true,
"hoverProvider": true,
"codeActionProvider": true,
"completionProvider": {
"triggerCharacters": [
"."
],
"resolveProvider": true
},
"documentSymbolProvider": true,
"documentFormattingProvider": true,
"referencesProvider": true
}
}

[Trace - 16:47:18] Sending notification 'initialized'.
Params: {}

[Trace - 16:47:18] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/jk/craps/haskellls/myproj2/app/Main.hs",
"languageId": "haskell",
"version": 1,
"text": "module Main where\n\nimport Lib\nimport ModuleA\n\nmain :: IO ()\nmain = someFunc\n\ntables :: Int -> Int\ntables a = a\n"
}
}

[Trace - 16:47:18] Received notification 'window/logMessage'.
Params: {
"type": 4,
"message": "Using hie version: Version 1.3, Git revision 6dc7d4302b3dd644163a318d66a2cebd29e37b0b (3880 commits) x86_64 ghc-8.8.3"
}

Using hie version: Version 1.3, Git revision 6dc7d4302b3dd644163a318d66a2cebd29e37b0b (3880 commits) x86_64 ghc-8.8.3
2020-05-02 16:47:19.123584239 [ThreadId 14] - New cradle: /home/jk/craps/haskellls/myproj2/app/Main.hs
[Trace - 16:47:19] Received notification 'window/logMessage'.
Params: {
"type": 4,
"message": "Using hoogle db at: /home/jk/.hoogle/default-haskell-5.0.17.hoo"
}

Using hoogle db at: /home/jk/.hoogle/default-haskell-5.0.17.hoo
2020-05-02 16:47:19.12397653 [ThreadId 14] - Module "/home/jk/craps/haskellls/myproj2/app/Main.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/jk/craps/haskellls/myproj2", cradleOptsProg = CradleAction: Stack}
2020-05-02 16:47:19.124028487 [ThreadId 14] - Found cradle: Cradle {cradleRootDir = "/home/jk/craps/haskellls/myproj2", cradleOptsProg = CradleAction: Stack}
[Trace - 16:47:19] Received request 'window/workDoneProgress/create - (0)'.
Params: {
"token": 0
}

[Trace - 16:47:19] Sending response 'window/workDoneProgress/create - (0)'. Processing request took 0ms
No result returned.

[Trace - 16:47:19] Received notification '$/progress'.
Params: {
"value": {
"kind": "begin",
"cancellable": false,
"title": "Initializing Stack project",
"percentage": 0
},
"token": 0
}

2020-05-02 16:47:19.502231759 [ThreadId 21] - Using main module: 1. Package `myproj2' component myproj2:exe:myproj2-exe with main-is file: /home/jk/craps/haskellls/myproj2/app/Main.hs
2020-05-02 16:47:19.640930386 [ThreadId 21] - myproj2> configure (lib + exe)
2020-05-02 16:47:20.061175751 [ThreadId 21] - Configuring myproj2-0.1.0.0...
2020-05-02 16:47:20.231268918 [ThreadId 21] - myproj2> initial-build-steps (lib + exe)
2020-05-02 16:47:20.368787728 [ThreadId 21] - The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
2020-05-02 16:47:20.36893471 [ThreadId 21] - Configuring GHCi with the following packages: myproj2
2020-05-02 16:47:20.902164226 [ThreadId 29] - /home/jk/craps/haskellls/myproj2/.stack-work/install/x86_64-linux-tinfo6/f13292f60e55f6476152e8dd73f068e4b2715f5a95baf1d1b3a7ec92ae901b3f/8.8.3/pkgdb:/home/jk/.stack/snapshots/x86_64-linux-tinfo6/f13292f60e55f6476152e8dd73f068e4b2715f5a95baf1d1b3a7ec92ae901b3f/8.8.3/pkgdb:/home/jk/.stack/programs/x86_64-linux/ghc-tinfo6-8.8.3/lib/ghc-8.8.3/package.conf.d
2020-05-02 16:47:21.051824191 [ThreadId 17] - Cradle set succesfully
[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "report",
"percentage": 33.333333333333336,
"message": "Lib"
},
"token": 0
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "report",
"percentage": 66.66666666666667,
"message": "ModuleA"
},
"token": 0
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "report",
"percentage": 100,
"message": "Main"
},
"token": 0
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "end"
},
"token": 0
}

[Trace - 16:47:21] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/jk/craps/haskellls/myproj2/app/Main.hs",
"diagnostics": []
}

[Trace - 16:47:21] Received request 'window/workDoneProgress/create - (1)'.
Params: {
"token": 1
}

[Trace - 16:47:21] Sending response 'window/workDoneProgress/create - (1)'. Processing request took 0ms
No result returned.

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "begin",
"cancellable": false,
"title": "loading",
"percentage": 0
},
"token": 1
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "report",
"percentage": 33.333333333333336,
"message": "Lib"
},
"token": 1
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "report",
"percentage": 66.66666666666667,
"message": "ModuleA"
},
"token": 1
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "report",
"percentage": 100,
"message": "Main"
},
"token": 1
}

[Trace - 16:47:21] Received notification '$/progress'.
Params: {
"value": {
"kind": "end"
},
"token": 1
}

[Trace - 16:47:21] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/jk/craps/haskellls/myproj2/app/Main.hs",
"diagnostics": []
}

Describe the bug

I don't see types in autosuggestion from imported module. It's happen only with module created in the project.

Suggestions in created module.
image

Suggestions when I import that created module.
image

Suggestions for prelude works correct.
image

I also don't see suggestions for types like Int, String at all.

Reproduce the bug

Create a module and after that import the module to other module find function from imported module in auto suggestion.

I also checked it with minimal settings of nvim and it's the same.

@Avi-D-coder
Copy link
Contributor

This is an issue for hie not coc.

@oblitum
Copy link
Member

oblitum commented May 2, 2020

agreed.

@oblitum oblitum closed this as completed May 2, 2020
@Ja-rek
Copy link
Author

Ja-rek commented May 3, 2020

I don't see any sense in it.
So why show_documentation() works
image

and autosuggestion doesn't work?
image

I don't see any problem with hie in logs...

@oblitum
Copy link
Member

oblitum commented May 3, 2020

It's two different requests and their response, by the server, coc.nvim just display it.

@chemzqm
Copy link
Member

chemzqm commented May 3, 2020

Should be problem of your language server, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

@Ja-rek
Copy link
Author

Ja-rek commented May 3, 2020

Sorry, I quite new in the Haskell.
Is there any alternative that works with COC well?
Does someone use ghcide, haskell-language-server?

@Avi-D-coder
Copy link
Contributor

I use hie with coc every day. Ghcide is less feature rich, but might be worth a try.

@Ja-rek
Copy link
Author

Ja-rek commented May 3, 2020

Does that bother, disturb you in writing the code?
Is this an HIE bug or the feature was just ignored?

@Avi-D-coder
Copy link
Contributor

The state of Haskell IDEs is WIP.
However types do show up in auto complete for me.

@Ja-rek
Copy link
Author

Ja-rek commented May 3, 2020

I don't know why for you it works.
When I open the same project in VSCode it works correctly.

@oblitum
Copy link
Member

oblitum commented May 3, 2020

When I open the same project in VSCode it works correctly.

Did you check whether VSCode using the same system hie-wrapper and not its own downloaded binary from extension?

@Avi-D-coder
Copy link
Contributor

I can sort of reproduce.

Starting with:

test :: Int
test = undefined

ciwD on Int produces a completion prompt including Double.

Starting with:

test = undefined

typing test :: D no type completions.
Both on coc and vscode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants