Skip to content

nimsuggest: case insensitivity support #21228

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

Open
Akronae opened this issue Jan 5, 2023 · 4 comments
Open

nimsuggest: case insensitivity support #21228

Akronae opened this issue Jan 5, 2023 · 4 comments

Comments

@Akronae
Copy link

Akronae commented Jan 5, 2023

Summary

Supporting different case types is something that is really bragged on about Nim, but in reality it is impossible to conveniently code using snake_case as nimsuggest/std lib is totally opiniated to camelCase.

How about not having to configure anything at all but just nimSuggest infering your coding style from your input ?

Seems simple enough, I'm pretty new to Nim though maybe there is something I'm overlooking.
I would be interested to contribute.

Description

This would fix the currently very unstable coding experience of people taking advantage of Nim's partial case insensitivity.

Alternatives

No response

Examples

I have a module A with a proc myProc
if I type A. nimsuggest will suggest me A.myProc
if I type A.my_ nimsuggest will suggest A.my_proc

A more advanced flavor would be for nimsuggest to look backward and check wether I used snake_case for other identifiers and suggest straight away A.my_proc while still suggesting A.myProc if I type A.myP

Backwards Compatibility

No response

Links

#16772

@Araq
Copy link
Member

Araq commented Jan 27, 2023

Seems to be a good idea.

@Akronae
Copy link
Author

Akronae commented Jan 27, 2023

Would like to contribute and see if I can draft a PR, is there anything I should do to get onboarded, or can I start straight away?

@ringabout
Copy link
Member

Yeah, go for it! It's yours!

@Akronae
Copy link
Author

Akronae commented May 7, 2023

I'm having a really hard time trying to make my dev environment work.

Just cloned the repo, and compiled from sources with

bash build_all.sh

If I try to interact with nimsuggest using a relative path it works fine

./bin/nimsuggest --stdin --debug --v2 nim.nimble
> sug compiler/suggest.nim 185 1

But if I add ./bin to my path, then by asking sug compiler/suggest.nim 185 1 to nimssugest, I get a segfault, yet I did not change any source.

image

My guess is that by adding ./bin to my path, one of these tool is called by nimsuggest, and is not really working well
image

When not adding ./bin to my path, my nimsuggest that has been built is calling tools from my Nim Homebrew installation.

This is the content of my ~/nimsuggest.log

fatal error: Module jsheaders is designed to be used with the JavaScript backend.
fatal error: Module jsformdata is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Crash
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsheaders is designed to be used with the JavaScript backend.
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsformdata is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Crash
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Module jsformdata is designed to be used with the JavaScript backend.
fatal error: Module jsheaders is designed to be used with the JavaScript backend.
fatal error: Crash
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: command expects a filename
fatal error: command expects a filename
fatal error: Module jsheaders is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsformdata is designed to be used with the JavaScript backend.
fatal error: Module jsheaders is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Choosen hash primitive is not yet supported!
fatal error: command expects a filename
fatal error: command expects a filename
fatal error: Module jsheaders is designed to be used with the JavaScript backend.
fatal error: Module jsbigints is designed to be used with the JavaScript backend.
fatal error: Module jsfetch is designed to be used with the JavaScript backend.
fatal error: Module jsformdata is designed to be used with the JavaScript backend.
fatal error: Crash
fatal error: Module jsfetch is designed to be used with the JavaScript backend.

I'm a bit lost, any idea?
Using Nim 1.9.1 on M1 mac

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

No branches or pull requests

3 participants