Skip to content

All top-level def forms should have consistent font-lock #578

@j-cr

Description

@j-cr

Some thoughts on syntax highlighting.

(def foo 42) ; font-lock-variable-name-face
(defn bar [x] x) ; font-lock-function-name-face

I think variable-name-face should be used for foo in (let [foo 42] ...), but not for foo in (def foo 42). Top-level definitions should use the same face, whether its a function or a 'variable'. It seems more logical, since if I want to make both "foo" and "bar" use the same bold and highly visible face (since both are top-level defs), then e.g. in my c code I get local variables and function arguments highlighted with the same face.

I guess the correct hierarchy would be: top-level-definition-face -> (function-face, var-face[1]). It would be nice to have a separate space for def-like keywords as well (so a user could highlight "defn", but not "do" or "let").

[1]: technically defn also creates a var; what's the best short name for a top-level definition that is not a function? Do we actually need/want this distinction at all? I don't really see how it's useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions