Skip to content

none-cradle is not respected by HLS #2692

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

Closed
tchoutri opened this issue Feb 5, 2022 · 9 comments
Closed

none-cradle is not respected by HLS #2692

tchoutri opened this issue Feb 5, 2022 · 9 comments
Labels
component: ghcide status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@tchoutri
Copy link
Contributor

tchoutri commented Feb 5, 2022

Your environment

Which OS do you use: Fedora 34

HLS version: haskell-language-server version: 1.6.1.1 (GHC: 8.10.7)

Which LSP client (editor/plugin) do you use: Neovim's LSP client

Describe your project: https://github.com/tchoutri/pg-entity

Steps to reproduce

run haskell-language-server-wrapper --debug in the project with the following hie.yaml

cradle:                                                   
  multi:
    - path: "./example"                                   
      config:
        cradle:
          none:
    - path: "./"                                          
      config:
        cradle:
          cabal:
            - path: "./src"
              component: "lib:pg-entity"

            - path: "./test"
              component: "pg-entity:test:entity-test"

Expected behaviour

HLS ignores the files located in ./example

Actual behaviour

HLS tries to process the files in ./example and fails. Meanwhile, hie-bios has no trouble determining that these files have no cradle:

❯ hie-bios debug example/app/Main.hs       
No cradle

Include debug information

2022-02-05 18:28:54.720122789 [ThreadId 383] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity/Internal/Unsafe.hs"
2022-02-05 18:28:54.72018192 [ThreadId 385] DEBUG hls:  hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/test/Main.hs"
2022-02-05 18:28:54.720231304 [ThreadId 387] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity/DBT.hs"
2022-02-05 18:28:54.720280258 [ThreadId 389] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity.hs"  
2022-02-05 18:28:54.72033031 [ThreadId 391] DEBUG hls:  hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity/Internal/QQ.hs"
2022-02-05 18:28:54.720452395 [ThreadId 382] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/example/src/Processing/Entity.hs"
2022-02-05 18:28:54.72050127 [ThreadId 384] DEBUG hls:  hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/test/GenericsSpec.hs"
2022-02-05 18:28:54.720547124 [ThreadId 386] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/example/app/Main.hs"
2022-02-05 18:28:54.720662027 [ThreadId 388] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity/Internal/BlogPost.hs"
2022-02-05 18:28:54.720741116 [ThreadId 414] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity/Types.hs"
2022-02-05 18:28:54.720790094 [ThreadId 390] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/src/Database/PostgreSQL/Entity/Internal.hs"
2022-02-05 18:28:54.721004093 [ThreadId 409] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "/home/tchoutri/Projects/pg-entity/test/EntitySpec.hs"
2022-02-05 18:28:54.721616033 [ThreadId 456] INFO hls:  Consulting the cradle for "example/app/Main.hs"                 
2022-02-05 18:28:54.721891196 [ThreadId 456] DEBUG hls: Output from setting up the cradle Cradle {cradleRootDir = "/home/tchoutri/Projects/pg-entity", cradleOptsProg = CradleAction: Cabal}
2022-02-05 18:28:54.721965569 [ThreadId 456] DEBUG hls: Session loading result: Left []                                 
2022-02-05 18:28:54.725585652 [ThreadId 547] INFO hls:  Consulting the cradle for "example/src/Processing/Entity.hs"    
2022-02-05 18:28:54.725747485 [ThreadId 547] DEBUG hls: Output from setting up the cradle Cradle {cradleRootDir = "/home/tchoutri/Projects/pg-entity", cradleOptsProg = CradleAction: Cabal}
2022-02-05 18:28:54.72583645 [ThreadId 547] DEBUG hls:  Session loading result: Left []                                 
2022-02-05 18:28:56.214598877 [ThreadId 340] INFO hls:  finish: User TypeCheck (took 1.49s)                             
2022-02-05 18:28:56.307457234 [ThreadId 1081] INFO hls: finish: GetHie (took 0.09s)                                     
2022-02-05 18:28:56.30810004 [ThreadId 1144] INFO hls:  finish: GenerateCore (took 0.00s)                               
2022-02-05 18:28:56.311785919 [ThreadId 1146] DEBUG hls:    LOOKUP UP PERSISTENT FOR: GetModSummaryWithoutTimestamps    
2022-02-05 18:28:56.311905204 [ThreadId 1146] DEBUG hls:    LOOKUP UP PERSISTENT FOR: False                             
Files that failed:                                                                                                      
 * /home/tchoutri/Projects/pg-entity/example/app/Main.hs                                                                
 * /home/tchoutri/Projects/pg-entity/example/src/Processing/Entity.hs                                                   
                                                                                                                        
Completed (10 files worked, 2 files failed)                                                                             
2022-02-05 18:28:56.357170892 [ThreadId 1150] DEBUG hls:    LOOKUP UP PERSISTENT FOR: GetModSummaryWithoutTimestamps    
2022-02-05 18:28:56.357272158 [ThreadId 1150] DEBUG hls:    LOOKUP UP PERSISTENT FOR: False                             
haskell-language-server-wrapper: callProcess: /home/tchoutri/.ghcup/bin/haskell-language-server-8.10.7 "--debug" (exit 2): failed                                                                                                                                                                                                                         ```
@tchoutri tchoutri added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Feb 5, 2022
@tchoutri tchoutri changed the title none-cradle for example folder is not respected by HLS none-cradle is not respected by HLS Feb 5, 2022
@fendor fendor added the level: easy The issue is suited for beginners label Feb 5, 2022
@ThomasCrevoisier
Copy link
Contributor

👋 From what I could reproduce, we end up in one of the CradleNone cases here.

So the file is processed correctly according to your hie.yaml file, it's just not obvious that it has been ignored.

#2701 aims to make things a bit clearer for such case.

@tchoutri
Copy link
Contributor Author

Thank you very much. :)

@tchoutri
Copy link
Contributor Author

That being said I'm not certain if this helps with the fact that HLS quits with exit code 1 after processing those files? The documentation on hie-bios says

The none cradle says that the IDE shouldn't even try to load the project.

Which is not what I'm seeing from the HLS logs.

@fendor fendor added the Hackathon This issue is suitable for hackathon sessions label Jun 11, 2022
@Soupstraw
Copy link

I'll take this one

@pepeiborra
Copy link
Collaborator

pepeiborra commented Oct 8, 2022

2022-02-05 18:28:56.311785919 [ThreadId 1146] DEBUG hls:    LOOKUP UP PERSISTENT FOR:  GetModSummaryWithoutTimestamps    
2022-02-05 18:28:56.311905204 [ThreadId 1146] DEBUG hls:    LOOKUP UP PERSISTENT FOR: False                             
Files that failed:                                                                                                      
 * /home/tchoutri/Projects/pg-entity/example/app/Main.hs                                                                
 * /home/tchoutri/Projects/pg-entity/example/src/Processing/Entity.hs                                                   
                                                                                                                    
Completed (10 files worked, 2 files failed) 

I think that we are a bit confused on the semantics of haskell-language-server-wrapper --debug. If I remember correctly, it looks for all the .hs files in the current folder, recursively, and tries to type check them. This has nothing to do with how the LSP server works, so it's not a good reproducer of the issue

@tchoutri
Copy link
Contributor Author

tchoutri commented Oct 8, 2022

@pepeiborra ah, that would be a nice behaviour to document :)

@Soupstraw
Copy link

I get the same result when running without the --debug flag. It doesn't just recurse into the sub-directories, but also first consults the cradle files to decide what do do with each directory.

@Soupstraw
Copy link

It doesn't make sense to have the program fail when the user has explicitly told hls to ignore specific directories.

@michaelpj michaelpj added status: blocked Not actionable, because blocked by upstream/GHC etc. and removed level: easy The issue is suited for beginners Hackathon This issue is suitable for hackathon sessions labels May 17, 2023
@michaelpj
Copy link
Collaborator

I'm unsure if there is actually still anything to do here, please reopen if you think there is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants