Skip to content

Optional ns-qualified keywords #6

@vemv

Description

@vemv

Hi @PawelStroinski !

Very nice lib - I'm looking forward to use it the next time the need pops up.

It occurred to me that if each keyword had a ns-qualified equivalent, one could:

  • have them auto-completed
    • e.g. ::stevia/<TAB> and see what's there
  • associate documentation to them
    • If keywords can be mapped 1:1 to a namespace/location, then tools jump to them / show a "docstring"
    • this would be a nice place to e.g. copy the official Docker documentation, so that one can learn about the keywords' semantics.

In practice, this an agnostic pattern that works:

(spec/def ::from string?
  #_"The FROM instruction initializes a new build stage and sets the Base Image for subsequent instructions.
As such, a valid Dockerfile must start with a FROM instruction.
The image can be any valid image – it is especially easy to start by pulling an image from the Public Repositories.")

...the #_ is a minimalistic way to add a docstring even when it's not supported currently at Spec level.

A couple of tools that can work with that:

  • CIDER has cider-find-keyword to jump to the 'definition' of the keyword
  • clojure-lsp can show the whole source code of something in a popup.

wdyt?

Thanks - V

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions