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

Is it intention that "." is a word constituent in the syntax table? #187

Open
schoettl opened this issue Oct 11, 2022 · 7 comments
Open

Comments

@schoettl
Copy link

elm-mode seems to treat dots as part of a identifier, e.g. model.state is one word.

This means that in evil mode many commands don't work as expected, e.g. w, b, Ctrl-], *, etc.

I'm aware that .state is also a function to access the state property of model. But in most cases . is not part of an identifier – at least in my code.

How about making . not a punctation instead of a word constituent?

(modify-syntax-entry ?. ".")

@purcell
Copy link
Collaborator

purcell commented Oct 11, 2022

See #106 and (subsequently) 3f042ec.

@purcell
Copy link
Collaborator

purcell commented Oct 11, 2022

Perhaps that provides a bit of context about what the trade-offs might be.

@schoettl
Copy link
Author

So eglot and elm lang server really need that for completion to work? I mean, model.state are actually two symbols, not one?

And can these programs complete JD.decode if JD is an import Json.Decoder as JD?

Do these programs also have a "jump to definition" that works with dot being a symbol constituent?

@purcell
Copy link
Collaborator

purcell commented Oct 11, 2022

So eglot and elm lang server really need that for completion to work?

Yes, as far as I remember.

I'm not working with Elm much these days, so maybe try applying your suggested change and see what works or perhaps doesn't with elm-language-server.

@schoettl
Copy link
Author

I currently don't have time to investigate elm-language-servers behavior – I don't use it myself. I'll fix this in my own emacs config for now.

I'd suggest we leave this issue open as reference for others.

Generally, I think it's better to define the syntax entries semantically correct, i.e. "." not being a symbol constituent because most of the time it isn't. To be honest, I can hardly imagine that the language server needs multiple identifiers to be understood as one term for completion to work.

@purcell
Copy link
Collaborator

purcell commented Oct 19, 2022

semantically correct "." not being a symbol constituent because most of the time it isn't.

In Maybe.map, the . is a symbol constituent. One would reasonably expect symbol-at-point to return Maybe.map there, not map.

I can hardly imagine that the language server needs multiple identifiers to be understood as one term for completion to work

Really? For the backend to know whether to correctly complete "ma" to "map" or something else, it needs to know whether or not that string is a prefixed symbol like Maybe.ma.

But yes, needs some testing before we can know if a change is warranted.

@schoettl
Copy link
Author

Hm, I would have seen Maybe.map as two identifiers i.e. two symbols: Maybe the identifier for the module and map the identifier for the function within the module. I thought most IDE integration tools are context-aware to a degree.

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

2 participants