Skip to content

find-symbol doesn't work on macros #47

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

Closed
expez opened this issue Apr 3, 2015 · 6 comments
Closed

find-symbol doesn't work on macros #47

expez opened this issue Apr 3, 2015 · 6 comments
Assignees
Labels

Comments

@expez
Copy link
Member

expez commented Apr 3, 2015

No description provided.

@expez expez added the bug label Apr 3, 2015
@benedekfazekas
Copy link
Member

i would argue this is a known limitation and solving it would be an enhancement. but just my 5c...

deffo top prio for next bigish release

@benedekfazekas
Copy link
Member

just sharing some of my notes/thoughts on this as it is not trivial and finding a simple enough solution will be hard ;)

two sides of the macro problem for find symbols (and all features based on on it):

  1. macros are not found when find-symbol is run
    example: let not found, assert not found
  2. as they are expanded occurrences of stuff is found in what they are expanded into
    example: str is found wherever there is an assert (but str is not present there in the source)

root cause: they are expanded before the AST build which is necessary to have a AST which represents code that compiles.

@benedekfazekas
Copy link
Member

#79 is basically 2.

@expez expez self-assigned this Jun 3, 2015
@expez expez changed the title Find-usages doesn't work on macros find-symbol doesn't work on macros Jun 5, 2015
expez added a commit that referenced this issue Jun 5, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jun 8, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jun 13, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
@tsdh
Copy link

tsdh commented Jul 7, 2015

IIUC, one bad side-effect of this issue is that cljr-clean-ns will silently remove requires for namespaces from which only macros are used.

@expez
Copy link
Member Author

expez commented Jul 7, 2015

We handle macros using a different mechanism in clean-ns. It should be able to handle this. If you have reproducible situation I'd love a bug report!

@tsdh
Copy link

tsdh commented Jul 7, 2015

@expez Ok, I'll try to create one.

expez added a commit that referenced this issue Jul 13, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jul 20, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jul 20, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jul 20, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jul 20, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
expez added a commit that referenced this issue Jul 20, 2015
We use rewrite-clj to traverse the source files using zippers.  This means
we can can find macros in some situations where we cannot build an AST.

The current solution has the following limitations:

- No support for (:use ... :rename {the-macro new-name})
- The position data is for the macro name instead of the form containing
  the macro.  This is different from the result returned by analyzing the
  ast for functions.  As this only happens for the definition itself I
  don't see any negative consequences by this difference.
@expez expez closed this as completed in 152b159 Jul 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants