Skip to content

qrti/funcList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FuncList

Retrieves functions, symbols, bookmarks from text or source files and lists references in a side editor. Clicking a references will reveal the corresponding position in text or source file.

New Version -> History
reworked virtual document handling

Change of Behavior
source files can't have multiple reference lists anymore
only temporary lists with slanted (tab) titles are updated correctly

Short Test Drive

  • open a source file (.c .h .cpp .hpp .ts .php .ps1 .asm)
  • select F1 > Show Functions
  • a side editor opens and shows a reference list
  • click a reference

funclist in action

Settings

extensions
list of file extension strings

native
regular expression to match functions, symbols, bookmarks
(native does not allow regEx groups)

display
regular expression to trim matches of nativeFilter for clean display
(display allows regEx groups 0-9 in options, see examples)

sort
0 = unsorted, order of appearance (appear)
1 = sorted, ignore case (nocase)
2 = sorted, obey case (case)

doubleSpacing
extended space in symbol list
false = off
true = on

Settings should look like this

"funcList": {
    "doubleSpacing": false,
    
    "filters": [
        {
            "extensions": [
                ".c",
                ".h"
            ],
            "native": "/^[a-z]+\\s+\\w+\\(/mgi",
            "display": "/\\S* +(\\w+)/1",
            "sort": 0
        },
        {
            ...
        }
    ]
}

Add your own filetypes and filters
- open settings with 'Menu/File/Preferences/Settings'
- enter funcList in the search field
- choose User or Workspace Settings
- click 'Edit in settings.json'
- place the cursor to a fitting place
- type funcList and hit enter to insert predefined settings
- edit them after your needs
- check for correct bracing and commas
- see -> Hints for easy regEx testing

Examples

TypeScript/Php Function Filter

"native": "/(?:^|\\s)function\\s+\\w+\\(/mg"

function encodeLocation(
function dispose(
simple functions will be found

"display": "/\\s*function\\s+(\\w+)/1"

encodeLocation
dispose
function names without keyword and opening bracket will be displayed

(Thanks to Avol-V)

Simple C Function Filter

"native": "/^[a-z]+\\s+\\w+\\(/mgi"

or

"native": "/^[a-z]+\\s+.*{][)$/img"

(Thanks to sungoth)

int main(
void initSerial(
simple function headers will be found

"display": "/\\S* +(\\w+)/1"

main
initSerial
function names without return value and opening bracket will be displayed

Assembler Target Filter

"native": "/^\\w+:\\s*$/mg"

encodeByte:
doSleep:
standalone targets on beginning of lines are found

mar01: mov r0,r1
abc17: ;comment
targets with following instruction or comment are not found

"display": "/\\w+/"

encodeByte
doSleep
targets are listed without colon or trailing spaces

Python Function Filter

"native": "/(?:^def|^class|^\\s+def|^\\s+class)\\s\\w+\\s*\\((?:\\s*|\\w+|[\\w\\*,\\s\\'\"=\\(\\)\\{\\}\\[\\]\\/\\.]+)\\):/img"
"display": "/.*\\)/"

(Thanks to Derek)

PowerShell Function Filter

"native": "/function\\s+\\w+-?\\w*\\s*{/img"  
"display": "/function\\s+(\\w+-?\\w*)/1i"

(Thanks to Paradox355)

Bookmark Filter

"native": "/^bookmark .+$/mg"

bookmark my mark 123
bookmark huubaBooba
or similar will be found

"display": "/\\w+\\s+(.*\\w)/1"

my mark 123
huubaBooba
will be listed

Hints

  • to show pure results of native filter use
    "display": "/.*/"
  • reference lists contribute two context menu entries
    'Switch Sort' for switching sort modes
    'Refresh' for manual refreshing the reference list
  • reference list tab names are surrounded by brackets
  • reference lists are read only and can't be saved
  • multiple found references are marked with bracketed numbers
    selectable with consecutive clicks
  • easy testing with online regEx engines
    for example regex101.com
    (omit regEx groups in display filter for testing)
  • settings from previous versions can be deleted
    "funcList.xxx": "xxx"

History

  • V0.5
    based on document content provider
    reference lists are read only and have to be closed and reopened for refresh and therefore loose user set width

  • V0.6
    based on untitled file scheme
    reference lists are editable and refresh keeps user set width

  • V0.6.1
    strip CR/LF from native filter to resolve Issue 1
    example for TypeScript filter
    revised examples

  • V7.0.0
    back to (improved) document content provider
    reference lists are read only and keep user set width
    no side effects when closing document or vscode

  • V7.1.0
    new option 'doubleSpacing' -> Settings
    fixed CR/LF bug for Unix/Linux/MacOS documents, addresses again Issue 1

  • V7.1.1
    new example filter for PowerShell functions -> Examples

  • V7.2.1
    new sort options -> Settings
    Linux/Mac path bug fix
    corrected symbol match

  • V7.3.0
    file extension aware filters
    5 predefined filters

  • V7.3.1
    updated readme

  • V7.6.2
    reworked virtual document handling

  • V7.6.3
    additional simple C- and new Python-Filter added to documentation

How to run locally

  • npm run compile
    to start the compiler in watch mode
  • open this folder in vsCode and press F5

About

vsCode extension to list functions, symbols, bookmarks by configurable regular expressions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published