Skip to content

Instantly share code, notes, and snippets.

@Fred-Vatin
Last active January 25, 2022 23:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fred-Vatin/791f8b434585604f2cd557606c499fb3 to your computer and use it in GitHub Desktop.
Save Fred-Vatin/791f8b434585604f2cd557606c499fb3 to your computer and use it in GitHub Desktop.
Custom settings for the VSCode extension Mark Jump

Description

These are custom settings for the VSCode extension Mark Jump

You'll be able to organize your code files in sections and easy jump to either of them :

  • MARKS
  • TODO / FIX
  • NOTE

Just place your sections in comments and respect format below.

Note: they replace the default settings to avoid conflicts

Features

  • Case insensitive
  • Heading level support by adding prefix
    • # or > are level 1 (mandatory)
    • ## or >> are level 2
    • ### or >>> are level 3
    • and so on
  • Precede and follow your # with a space. e.g.: // # Awesome title
  • Precede your todo, fix and note with > (mandatory)
  • Don’t forget to end todo, fix and note with a colon : (doesn’t matter if surronding by [space])
  • Matches all sections in comments beginning with // or /* or <!-- or -- or rem or ::. They have to be on the same line
  • Matches all sections that are at the beginning of a line (supports spaces/tabs before)
  • Writers name into parenthesis for todo, fix and note are optional

This settings should be relevant at least for JS, JSON, CSS, HTML/XML, Lua, bat/cmd files. I will keep the GIST updated for fixes and more languages support. Else add your own patterns with small needed edition of those existent ones to add the comments that the marks should support.

Please add a comment to this GIST to alert me of issues or questions.

Preview

// # LEVEL 1
var codeA = 'any line of code here'

/*>> TODO(fred) : LEVEL 2
>> NOTE (bob) : LEVEL 2*/

var codeB = 'any line of code here'

// # LEVEL 1 bis

var codeC = 'any line of code here'

/*>> TODO(fred) : LEVEL 2 bis
>> NOTE (bob) : LEVEL 2 bis*/

var codeD = 'any line of code here'

Use ctrl+alt+s or ctrl+alt+m to display the widget

Screenshot

Installation

  1. Install Mark Jump extension if you didn't already do.
  2. Copy and paste the attached Mark Jump custom settings.json content to your VSCode user settings file.
    • Optionnaly, do the same for the attached Jump custom keybindings.json. It swithes the default key ctrl+alt+s and ctrl+alt+m
  3. Save settings and enjoy
/* ====================== # MARK JUMP ======================
Extension required: Mark Jump
Install command: ext install mark-jump
Description: Jump to the marked section in the code
******************************************************************/
// "Jump to sections" any type
{
"key": "ctrl+alt+s",
"command": "markJump.jumpToMark"
},
// Jump to bookmarks only
{
"key": "ctrl+alt+m",
"command": "markJump.jumpToSection"
}
// # EXTENSION: Mark Jump
"markJump.sectionPatterns": [
// Matches JS comments style "// [any chars] # MARK TITLE [any chars]"
"(?:\\/\\/.*?[\\s\\b]|\\/\\/.*)[^\\\"#\\']#(?<heading>#+)?\\s+?(?<description>\\w.+?)[ #\\\\*=\\/\\->]*$",
// Matches JS/CSS comments style "/* [any chars] # MARK TITLE [any chars]"
"(?:\\/\\*.*?[\\s\\b]|\\/\\*)[^\\\"#\\']#(?<heading>#+)?\\s+?(?<description>\\w.+?)[ #\\\\*=\\/\\->]*$",
// Matches HTML/XML comments style "<!-- [any chars] # MARK TITLE [any chars]"
"(?:\\<!--.*?[\\s\\b]|\\<!--)[^\\\"#\\']#(?<heading>#+)?\\s+?(?<description>\\w.+?)[ #\\\\*=\\/\\->]*$",
// Matches LUA comments style "-- [any chars] # MARK TITLE [any chars]"
"^[ \\t]*?--[^\\\"#\\'a-zA-Z0-9]+?#(?<heading>#+)?\\s+?(?<description>\\w.+?)[ #\\\\*=\\/\\->]*$",
// Matches Batch comments style "rem|:: [any chars] # MARK TITLE [any chars]"
"^[ \\t]*?(?:rem|::)[^\\\"#\\'a-zA-Z0-9]+?#(?<heading>#+)?\\s+?(?<description>\\w.+?)[ #\\\\*=\\/\\->]*$",
// Match "[line start] # MARK TITLE [any chars]"
"^\\s*?#(?<heading>#+)?\\s+?(?<description>\\w.+?)[ #\\*=\\/\\->]*$"
],
"markJump.todoPatterns": [
// Match "[any chars] > [TODO or FIX (author):] TITLE [any chars]"
"\\>(?<heading>\\>+)?\\s?\\b[Tt][Oo][Dd][Oo]\\b\\s?(\\((?<writer>[^\\)]+)\\))?\\s?:\\s?(?<description>.+?)[ #\\*=\\/\\->]*$",
"\\>(?<heading>\\>+)?\\s?\\b[Ff][Ii][Xx]\\b\\s?(\\((?<writer>[^\\)]+)\\))?\\s?:\\s?(?<description>.+?)[ #\\*=\\/\\->]*$"
],
"markJump.notePatterns": [
// Match "[any chars] > NOTE (author): TITLE [any chars]"
"\\>(?<heading>\\>+)?\\s?\\b[Nn][Oo][Tt][Ee]\\b\\s?(\\((?<writer>[^\\)]+)\\))?\\s?:\\s?(?<description>.+?)[ #\\*=\\/\\->]*$"
],
"markJump.additionalNotePatterns": [
// Match "[any chars] ? NOTE (author): TITLE [any chars]"
"\\?(?<heading>\\?+)?\\s?\\b[Nn][Oo][Tt][Ee]\\b\\s?(\\((?<writer>[^\\)]+)\\))?\\s?:\\s?(?<description>.+?)[ #\\*=\\/\\->]*$",
// Match "[any chars] ! NOTE (author): TITLE [any chars]"
"\\!(?<heading>\\!+)?\\s?\\b[Nn][Oo][Tt][Ee]\\b\\s?(\\((?<writer>[^\\)]+)\\))?\\s?:\\s?(?<description>.+?)[ #\\*=\\/\\->]*$"
],
@RoneoOrg
Copy link

Really helpful, even years later.
Thank you

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