Giter VIP home page Giter VIP logo

funclist's Introduction

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

funclist's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

funclist's Issues

Multiple keyword

Please i want to add .4gl files, but it use

FUNCTION name()
END FUNCTION
REPORT  name()
END
MAIN
END MAIN

How can i do work with that keywords??.

Actually just work for FUNCTION

thanks

[HELP]: Filter configuration not working

Hi,

I recently discovered your extension, and i started to test it. I develop FPGA by using VHDL language.
So i try to setup my own filter, but it doesn't work.

Here's a very simple line from my file:

signal toto : std_logic;

And my filter:

"funcList": {
    "doubleSpacing": false,

    "filters": [
      {
        "extensions": [
          ".vhd",
          ".vhdl"
        ],
        "native": "/^\\s*signal\\s+\\w+/mgi",
        "display": "/.*/"
        "sort": 0
      }
    ]
  }

I try my regex with an online website, and it works fine. But when i call the "show function", a new tab appears with no matches.

I don't see my mistakes.

Best regards,
Mathieu

Insert newlines between functions in list

I really like this extension. I have modified the settings to produce this type of list:

clearSearchInput()
getQuery(event)
getSearchSpecialsQuery(evt)
escapeRegExp(string)
searchTree(query2)

I would like to be able to insert a newline between each entry to make the list easier to read. The settings I am using:

// so that "function someName(arg1, arg2) is captured
"funcList.nativeFilter": "/^[a-z]+\\s+\\w+\\s*\\(.*\\)/mgi",
// now display "someName(arg1, arg2)"
"funcList.displayFilter": "/\\S* +(\\w+\\s*\\(.*\\))/1"

[solution] RegEx for NSIS scripts (Nullsoft Scriptable Install System)

Hello. This RegEx to build functions and sections list for NSIS script.
"native": "/(?:^|\s)(?:Functio|Section)(?:n\s|\s\42)\.?\w+/mgi",
"display": "/\s*(?:Functio|Section)(?:n\s|\s\42)\.?(\w+)/1",

Example
function fname
section "installing maker" secInstall

funcList result will be:

fname
installing

Feature Request -

If we write comments right above the functions, or consistently enclosed between some characters, e.g. between """ """ for a python function, that starts on a line right above it or something, then we can have an option to show those comments right next to the function list generated. Will give a brief overview about all the functions in a file.

Also, I refactor my code to multiple files, so, it would be nice to select files for the function list, and it could output text file with all the function names under a heading like so, fileA and then right below it all the functions, say fun1a , fun2a etc mentioned below it - with all the function descriptions scraped from above suggestion.

That'll make it a good overview of the project for someone who has just started reading the codebase.

[HELP] Keyboard shortcut example

I'm new to VSCode and would like your help. I'm trying to set up a keyboard shortcut for funcList for Python. The Python part works great but I'm lost as to how to set up the keyboard shortcut mapping in VSCode that will do the same thing as F1>Show Functions. I'd like your help. An example would be great.

Thanks.

I have tried., without success:
{
"key": "ctrl" "a",
"command": "extensions.action.showFunction",
"when": "editorTextFocus"
}

It doesn't like the "key" or the "command". The "key" I can probably figure out but do not have a clue as to what the "command" should be.

Extension issue

  • Issue Type: Bug
  • Extension Name: funclist
  • Extension Version: 7.6.3
  • OS Version: Darwin x64 20.3.0
  • VSCode version: 1.54.3

⚠️ We have written the needed data into your clipboard. Please paste! ⚠️

Unable to see the functions list. There are no warnings.

Do not show functions after last VSC update.

(by translator)
I'm not sure which VSC update, but the extension stopped working properly.

Follow my extension config and a sample file ( rename to .prw ).

Thank You.

**_"funcList": {
    "doubleSpacing": false,
    "filters": [
        {
            "extensions": [
                ".PRW",
                ".prw",
                ".PRX",
                ".prx",
                ".PRG",
                ".prg"
            ],
            "native" : "/\\b(method [a-z0-9() ,]+ cla|wsservice [a-z0-9].*|wsmethod [a-z0-9]+.*ws.*|static function .*|user function .*|wsstruct .*)+/ig",
            "display": "/\\b(method|wsservice|wsmethod|static function|user function|wsstruct)+\\s{1}[a-z0-9_]+/0i",
            "sort": 0
        }
    ]
},_**

RGENM110.txt

Will funclist support golang

there is my config:
"funcList": {
"doubleSpacing": false,
"filters": [
{
"extensions": [
".go",
".h"
],
"native": "/^[a-z]+\s+(\(([a-z]+)\s\([a-z]+)\)\s)?\w+\(/mgi",
"display": "/.
/",
"sort": 0
}
]
}
display methods is well,but goto method not work if it's a func of struct.

sort methods by class name

Hello,

Is it possible to list in a file a table with all functions of a PHP project sorted by class name (a column with class name, another one with method name)?

Thanks!

Filtering not working for PowerShell functions

Cannot get filtering working for PowerShell functions. I have thoroughly tested the regex statements which work everywhere except within this extension. Here are the settings I am using:

"funcList.nativeFilter": "/function\\s+\\w+-?\\w*\\s*{/img"
"funcList.displayFilter": "/(?![function])(?!\\s+)\\w+-?\\w*/img"

Search string example:

Function Verb-Noun {
     #Some filler here
}

Ruby Language method listing help

Hi There,

I am wondering what would be the correct json for Ruby methods and classes in .rb file
I'm having hard time with coming up regexes'
Examples
class MSExcel
def initialize
end
end
Also you can have methods not attached to a class such as
def methodname(var1,var2)
end

I would appreciate if you could list the complete json.

Thanks

No Filter fo Filetype

Hi

Thanks for this great extension. Unfortunately the latest update has broken this extension for me as I now get the error "no filter for filetype". I have tried checking the config for "filters.extensions" to try and update it with my extension (*.mq4) but it says this is an unknown configuration setting. I have also tried uninstalling and reinstalling but it hasn't helped. Any advice on how to make this work again please?

Abnormal resolution

file extension:c
static inline int function1(int a)
static void function2(int b)

The above two cases cannot be resolved
I have modified the configuration file: native: / ^ [a-z] + \ \ s +. * {] [) $/ img

Functions list permanently open

Hello,
I'm looking for permanently and updated functions lists tab. Is it possible to configure this extension to do it?

Best regards

Request:Count number of lines?

Would be nice to have the number of lines the function has as an option right next to the line with the function name.

Clicking reference did not work

Clicks just place cursor and do nothing.

My settings is:

"funcList.nativeFilter": "/(?:^|\\s)function\\s+\\w+\\(/mg",
"funcList.displayFilter": "/\\s*function\\s+(\\w+)/1",

Tested on ts and php files.

feature request: languadge depended regexps

Hi,
Thanks for the work!

I would like to suggest a feature to make possible to opt a regexp depending on the file language is edited.

E.g. to add an option of map [lang: regexp, lang2: regexp2] and if the file type matches on of the file type it uses a particular regexp otherwise It continues to use the global one.

Thanks a lot in advance,
Mik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.