ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Pep

by pedrorgirardi ST4

Elemental Clojure & ClojureScript code navigation, documentation, and usages analysis for Sublime Text.

Details

Installs

  • Total 5
  • Win 2
  • Mac 2
  • Linux 1
Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Pep

Pep leverages clj-kondo analysis data to provide code navigation, documentation and usages analysis.

clj-kondo is the sole dependency, and everything else is supplied by built-in Sublime Text APIs.

Command Status Description
pg_pep_analyze Stable Analyze view, paths or classpath
pg_pep_goto_anything Stable Go to anything in scope
pg_pep_goto_namespace Stable Go to namespace in scope
pg_pep_goto_var Stable Go to var in scope
pg_pep_goto_keyword Stable Go to keyword in scope
pg_pep_goto_spec Stable Go to spec in scope
pg_pep_goto_definition Stable Go to definition
pg_pep_goto_analysis_finding Stable Go to clj-kondo analysis finding (warning or error)
pg_pep_show_doc Stable Show documentation in a popup
pg_pep_jump Stable Jump to occurrences of symbol or keyword
pg_pep_jump_to_require Experimental Jump to namespace require of var under the cursor
pg_pep_jump_to_import Experimental Jump to import of class under the cursor
pg_pep_find_usages Stable Find usages in scope
pg_pep_select Stable Select occurrences of symbol or keyword
pg_pep_replace Stable Replace occurrences of symbol or keyword
pg_pep_highlight Stable Highlight occurrences of symbol or keyword
pg_pep_annotate Stable Annotate view (or lint view)
pg_pep_copy_name Stable Copy name of keyword or symbol to the clipboard
pg_pep_show_name Stable Show name of keyword or symbol in a popup

I have worked on Pep for over a year, but I still consider it alpha. Pep is part of my Clojure(Script) development setup, combined with Tutkain, so I think it's developed enough to be helpful.

You're welcome to try it, and I would be happy to hear if it works for you. If it doesn't work for you, I ask you to please create an issue, and I will do my best to address it.

Installation

Pep is available on PackageControl.

Annotate (Lint)

Pep Annotate

Highlight

Highlight the symbol or keyword under the cursor and its usage.

Pep Highlight

Documentation

Show documentation for var under the cursor.

Pep Show documentation

Jump

Jump to occurrences of symbol or keyword under cursor.

Pep Jump

Find Usages

Find usages of symbol or keyword under cursor.

Pep Find Usages

Select

Select occurrences of symbol or keyword under cursor.

Pep Select

It behaves like an 'intelligent multi cursor, and you can use it to rename symbols.

Goto Definition

Goto definition of a local binding, var, spec, re-frame handler.

Settings

Default settings:

Error: language “jsonc” is not supported
{
    "debug": false,

    "clj_kondo_path": "clj-kondo",

    "analysis_applicable_to": ["Packages/Clojure/Clojure.sublime-syntax",
                               "Packages/Clojure/ClojureScript.sublime-syntax",
                               "Packages/Tutkain/EDN (Tutkain).sublime-syntax",
                               "Packages/Tutkain/Clojure (Tutkain).sublime-syntax",
                               "Packages/Tutkain/ClojureScript (Tutkain).sublime-syntax",
                               "Packages/Tutkain/Clojure Common (Tutkain).sublime-syntax"],

    // True if you want to see clj-kondo warnings/errors displayed along the right-hand edge of the view.
    "annotate_view_analysis": false,

    // The font size used by view analysis annotations.
    "annotation_font_size": "0.9em",

    // True if you would like to see the number of clj-kondo errors, if any, in the status bar.
    "view_status_show_errors": false,

    // True if you would like to see the number of clj-kondo warnings, if any, in the status bar.
    "view_status_show_warnings": false,

    // True if you would like to show the namespace of the view in the status bar.
    "view_status_show_namespace": false,

    // If you would like to add a custom prefix to the namespace of the view in the status bar.
    "view_status_show_namespace_prefix": "Namespace: ",

    // If you would like to add a custom suffix to the namespace of the view in the status bar.
    "view_status_show_namespace_suffix": "",

    // True if you want to see the number of highlighted regions in the status bar.
    "view_status_show_highlighted": false,

    // If you would like to add a custom prefix to the number of highlighted regions in the status bar.
    "view_status_show_highlighted_prefix": "Usages: ",

    // If you would like to add a custom suffix to the number of highlighted regions in the status bar.
    "view_status_show_highlighted_suffix": "",

    // It's unlikely to need to analyze scratch views,
    // but you can run the command to analyze a view if needed.
    "analyze_scratch_view": false,

    // True if you would like to analyse your project's sources when the plugin is loaded.
    // (Doesn't do anything if there isn't a *.sublime-project file.)
    "analyze_paths_on_plugin_loaded": true,

    // True if you would like to analyze your project's sources when the project is loaded.
    // (Doesn't do anything if there isn't a *.sublime-project file.)
    "analyze_paths_on_load_project": true,

    // True if you would like to analyse your project's classpath when the plugin is loaded.
    // (Doesn't do anything if there isn't a *.sublime-project file.)
    "analyze_classpath_on_plugin_loaded": true,

    // True if you would like to analyse your project's classpath when the project is loaded.
    // (Doesn't do anything if there isn't a *.sublime-project file.)
    "analyze_classpath_on_load_project": true,

    // True if you would like to highlight vars, local bindings and keywords usages.
    "automatically_highlight": false,

    // True if you would like to highlight the region under the cursor.
    "highlight_self": true,

    // True if you would like to highlight the region with an outline.
    "highlight_region": true,

    // True if you would like to highlight the gutter.
    "highlight_gutter": false,
}

Sublime Project

To analyse your project's classpath and paths (your files), you need to configure Pep in your Sublime Project.

If you configure paths, you can go to definition, show documentation and find usages across files in your project. A paths analysis usually doesn't take long and will run when Pep is loaded or a project is loaded - see Settings "analyze_paths".

If you configure classpath, you can go to definition and show documentation of vars defined in libraries. Classpath analysis takes a little longer and will run when Pep is loaded, or a project is loaded - see Settings "analyze_classpath".

Sublime Project example:

{
    "pep": {
        "paths": ["src"],
        "classpath": "clojure -Spath"
    }
}

Acknowledgements

  • Eero and Tutkain; without Eero and Tutkain, I would not have started this project.
  • Michiel Borkent and clj-kondo; this project wouldn't be possible without clj-kondo.
  • Peter and Calva; Peter was too kind and allowed me to contribute to Calva in the early days and showed me how fun it is to work on these things.
  • The Sublime Text Discord community, a magnificent bunch of volunteers and Sublime HQ employees tirelessly helping people with questions related to Sublime Text. (Copied from Tutkain because I could not say it better.)