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

Support for highlighting #25

Open
rodrigues opened this issue Mar 8, 2018 · 1 comment
Open

Support for highlighting #25

rodrigues opened this issue Mar 8, 2018 · 1 comment

Comments

@rodrigues
Copy link

rodrigues commented Mar 8, 2018

Given I am viewing an Elixir file,
And the cursor is at a certain position in the screen (line, column),
I want to get the all ranges where the symbol at position appears.

Example:

defmodule Foo do
  @foo "foo"

  def foo(foo_arg), do: :foo
  defp foo_fn(arg_foo), do: :foobar
  defp foom, do: Bar.foo()

  def bar do
    foo = 1
    foo + 2
  end

  def foobar do
    foo = "foo"
    "#{foo}#{Bar.foo()}"
  end
end

If the cursor is on Bar.foo(), it should only highlight the two Bar.foo() calls, not the other occurrences of foo in the code, i.e. only the reocurrences of the same symbol.

defmodule Mod do
  def a do
    {:ok, 1}
  end
  
  def b do
    a()
  end

  def c do
    Other.a()
  end
end

Being at either a(), the definition or the call in b(), both should be highlighted, but not the one in c().

Local variables with same name but in different scopes shouldn't be considered the same symbol.

Not sure this is a very feasible problem to solve, but it seems that this library would be the right place for it. 🙂

That would allow elixir-ls to provide the documentHighlight feature: https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight

JakeBecker/elixir-ls#20

@msaraiva
Copy link
Owner

@rodrigues I've started changing the Parser and MetadataBuilder in order to provide column information. This is necessary for precise highlighting and other features like refactoring. After a couple of months with no time for any open source project, I might have a couple of days this week to finish this and some other pending issues.

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