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

Skip generating foreign calls under ghcide, generate stubs instead #128

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

nh2
Copy link
Member

@nh2 nh2 commented Nov 29, 2021

See haskell/haskell-language-server#365 (comment)

The __GHCIDE__ environment variable is not currently set by haskell-language-server -- if this approach I'm implementing here (TH using this env var) is sanctioned by HLS developers, HLS should set this variable. Currently I set it myself in my shell.

TH.varE ffiImportName
-- Note [ghcide-support]
-- haskell-language-server / ghcide cannot handle code that use
-- `addForeignFile`/`addForeignSource` as we do here; it will result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that it doesn't work, but I think what should be fixed is the tool, not the code generation part.
I don't want to add a flag for the tools here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what should be fixed is the tool, not the code generation part.

@junjihashimoto What fix do you suggest? There's none known to me.

If you find it better, we can use an environemnt variable that has in the name that linking does not work in this environment instead of __GHCIDE__ specifically, so it covers all tools where linking as expected by inline-c does not work.

I don't want to add a flag for the tools here.

Usage of inline-c breaks HLS (which it does), everybody will carry this patch anyway.

Copy link
Collaborator

@junjihashimoto junjihashimoto Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nh2 One idea is creating a ghc plugin and adding a mechanism to set functions that don't work. The plugin generates dummy code for each function. It's a code generation problem, so I think we can solve a series of problems by the plugin.

@junjihashimoto
Copy link
Collaborator

I'd like to create a separate branch to deal with it.

@nh2
Copy link
Member Author

nh2 commented Sep 28, 2023

I'd like to create a separate branch to deal with it.

@junjihashimoto What does that mean?

@junjihashimoto
Copy link
Collaborator

junjihashimoto commented Sep 29, 2023

It means that it just clones the patched one to own repository.

@junjihashimoto
Copy link
Collaborator

@nh2 I don't think it's an ideal solution, but it's better to merge, right?

@nh2
Copy link
Member Author

nh2 commented Sep 29, 2023

@nh2 I don't think it's an ideal solution, but it's better to merge, right?

Yes, probably. I just commented in haskell/haskell-language-server#365 (comment) because I think this change is still needed.

I think the only open question is how the env var should be called (haskell/haskell-language-server#365 (comment)) so it's probably cleanest to merge this PR here only once that's been decided and implemented in HLS.

@junjihashimoto junjihashimoto marked this pull request as ready for review September 29, 2023 19:09
@junjihashimoto junjihashimoto merged commit de3b85d into fpco:master Sep 29, 2023
@junjihashimoto
Copy link
Collaborator

@nh2 This PR is merged. inline-c-0.9.1.10 is available with this feature.

@nh2
Copy link
Member Author

nh2 commented Sep 29, 2023

@junjihashimoto Thanks!

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

Successfully merging this pull request may close these issues.

2 participants