mhanberg
Expert LSP Core Team
The docs state:
:end_of_expression- denotes when the end of expression effectively happens. Available for all expressions except the last one inside a__block__(when:token_metadatais true)
My question is about “except the last one inside a __block__”.
Is limitation based on the existing parser implementation or is there an “actual” (in quotes because I’m not sure the right wording here haha) reason for the exception?
cc @josevalim
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
mhanberg
Another question actually, is end_of_expression only included if the end of the expression cannot be computed from
{line, column + length(token)}?josevalim
I think it is because the last expression end is marked inside the
__block__already. But we can add more metadata if necessary.lukaszsamson
+1 for more metadata. No
end_of_expressionmeans editor tools need to reimplement this in every use case that involves going from AST to source code ranges. Here’s an example from ElixirLS elixir-ls/apps/language_server/lib/language_server/providers/document_symbols.ex at 7b3344cc845d0c608c291934bdc0e95b74a26da4 · elixir-lsp/elixir-ls · GitHub. Compare that to elixir-ls/apps/language_server/lib/language_server/providers/document_symbols.ex at 7b3344cc845d0c608c291934bdc0e95b74a26da4 · elixir-lsp/elixir-ls · GitHubmhanberg
I’ll look into it more to confirm, thanks!
mhanberg
Given the following code and result from
Code.string_to_quoted/2I am wondering what is the criteria that makes the
usecall and thebar()function call get an:end_of_expressionmetadata, but not any of the other expressions?I am not hoping for any particular answer, just want to know exactly how it works so I can reproduce it in Spitfire.
Thanks @josevalim.
mhanberg
Actually maybe I have figured it out moments after posting.
Is it because the the tokens given to
useare just AST, and not actually “expressions” at parse time, sinceuseis a macro? Same thing for the arguments todef, anddefand:okbeing the last expression inside theirdoblocks?josevalim
They are all expressions. The current docs state though that end_of_expression is added only to expressions with a
__block__(except the last one). The purpose ofend_of_expressionwas to format blocks properly, which is why it is limited in scope. We could add it to all constructs in a block though. Adding them to everything is a taller order (and probably not that useful).mhanberg
Oh, this was a missing piece then for me.
The current docs don’t actually mention that it’s only expressions in a block
I can easily incorporate this I think.
Thanks for helping me understand this!
PS: I don’t personally have a need to increase or decrease the metadata currently, just needed to know how the existing metadata works.
josevalim
Yeah. I actually tried to say that but my english failed me.
mhanberg
This is obvious now that I knew where to look in
elixir_parser.yrl.Thanks again for the help José!