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

Only namespaces containing prefixes are fontlocked in the ns form #280

Open
expez opened this issue Mar 11, 2015 · 8 comments
Open

Only namespaces containing prefixes are fontlocked in the ns form #280

expez opened this issue Mar 11, 2015 · 8 comments

Comments

@expez
Copy link
Member

expez commented Mar 11, 2015

Imgur

This happens most often in prefix vectors but applies everywhere

@bbatsov
Copy link
Member

bbatsov commented Mar 11, 2015

It's pretty hard to deal with this using regular expressions. Fixes welcome, but it's low on my todo list.

@cichli
Copy link
Member

cichli commented Mar 11, 2015

Bear in mind that single-segment namespaces are strongly advised-against as they cause issues with AOT and JVM interop.

@bbatsov
Copy link
Member

bbatsov commented Mar 11, 2015

@cichli That's debatable bbatsov/clojure-style-guide#100

@cichli
Copy link
Member

cichli commented Mar 11, 2015

Ah, was not aware that it did not actually cause problems in practice (although I seem to remember reading that how packageless classes are dealt with is JVM-dependent?).

It definitely can cause serious, hard-to-debug, issues in clojurescript though:

Compiler support for single segment namespaces has always been spotty and there's no intention to improve it. There are fundamental semantic issues - for example if you have a DOM element with a CSS id and you haven't supplied a namespace but you goog.require one with that name it will return the DOM element. Good luck debugging that.
Single segment namespaces are nearly alway representative of a problem waiting to manifest. If you want to use them then you can suppress the warning in your build options.

@bbatsov
Copy link
Member

bbatsov commented Mar 11, 2015

You might want to mention this in the style guide issue. :-)

On 11 March 2015 at 19:06, Michael Griffiths notifications@github.com
wrote:

Ah, was not aware that it did not actually cause problems in practice
(although I seem to remember reading that how packageless classes are dealt
with is JVM-dependent?).

It definitely can cause serious, hard-to-debug, issues in clojurescript
though:

Compiler support for single segment namespaces has always been spotty and
there's no intention to improve it. There are fundamental semantic issues -
for example if you have a DOM element with a CSS id and you haven't
supplied a namespace but you goog.require one with that name it will return
the DOM element. Good luck debugging that.
Single segment namespaces are nearly alway representative of a problem
waiting to manifest. If you want to use them then you can suppress the
warning in your build options.


Reply to this email directly or view it on GitHub
#280 (comment)
.

Best Regards,
Bozhidar Batsov

http://www.batsov.com

@expez
Copy link
Member Author

expez commented Mar 12, 2015

Is there any alternative font-locking mechanism for emacs that can be used when the context is hard to capture with a regex?

@bbatsov
Copy link
Member

bbatsov commented Mar 12, 2015

You can use anything for the font-locking, but I've rarely seen modes that aren't 100% regexp based. The use of a parser or a live process obviously adds extra deps and people generally prefer simpler solutions.

@expez
Copy link
Member Author

expez commented Jun 11, 2015

I guess I should point out that there are no single-segment namespaces in the OP.

There is no support for syntax highlighting of libspecs in clojure-mode yet, other than highlighting of stuff following this form: foo.bar.baz.

In the image in OP one can argue whether the prefix, refactor-nrepl-core, should be highlighted or if only the namespaces below this prefix should be highlighted (analyzer, find-symbol etc). My preference would be to highlight both the prefix and the suffixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants