-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: defmodule snippet infer module name #398
feat: defmodule snippet infer module name #398
Conversation
f97809b
to
dc54829
Compare
result = | ||
uri | ||
|> Path.split() | ||
|> Enum.reduce(false, fn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what the first element of the accumulator signifies here?
The clause with support is confusing me a tad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually the module in test/support
don't use Test
in the module name like https://github.com/elixir-tools/next-ls/blob/main/test/support/utils.ex
Can you explain what the first element of the accumulator signifies here?
do you mean false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the tuple {:test, []}
. I'm not sure what the atom is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used here to check if there is support
under test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the line that I am asking about.
I'm not sure where you use that later, you said something about tests ending in "Test", but i'm not seeing that either in this code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my bad, I'll try to explain.
I'm looking for three folders
lib
where usually the code is,lib/foo.ex
it's translated toFoo
(withoutlib
)test
where usually the tests are,test/foo_test.exs
it's translated toFooTest
(withouttest
)support
where usually are utils for tests,test/support/foo.ex
it's translated toFoo
(withouttest
andsupport
)
here are some tests that can help https://github.com/elixir-tools/next-ls/blob/9d65b759ac0cf86c943190342cf829097fc62346/test/next_ls/snippet_test.exs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, i understand now, thanks!
basically you are just striping lib/
, test/
and test/support/
from the beginning for the path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucacervello When you use someone else's code, please mention the source. If possible, contacting the author would be best; otherwise, it appears quite unethical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the code on main.
Sorry about that!
You're on fire! |
def ascend(nil, acc, _callback), do: acc | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
without it
defmod|
don't trigger autocomplete because there is no previous node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will merge after my last comment is answered.
9d65b75
to
0c48c40
Compare
defmodule snippet infer module name
recording 🎥
Screen.Recording.2024-03-14.at.09.29.30.mov