notepad-plus-plus / notepad-plus-plus/notepad-plus-plus

[functions list, Ruby] fix name of class methods defined as self.method

Open
#3,466 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

function list
Dominant language
C++
Stars
29.4k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Description of the Feature
Current behavior

Currently, class methods, defined with self.method, all get self as their function name.

Desired behavior

Instead of self, it would be nice if they get a proper name (in case of a method definition like def self.method: either the actual method name (method) or its definition name (self.method)).

A solution using the definition name can be accomplished by changing the following:

mainExpr="^\s*def\s+\w+"

to

mainExpr="(^\s*def\s+self\.\w+)|(^\s*def\s+\w+)"
<funcNameExpr expr="(?&lt;=def\s)\w+" />

to

<funcNameExpr expr="(((?&lt;=def\s)self.\w+)|((?&lt;=def\s)\w+))" />
mainExpr="^\s*def\s+\w+"

to

mainExpr="(^\s*def\s+self\.\w+)|(^\s*def\s+\w+)"
<nameExpr expr="(?&lt;=def\s)\w+" />

to

<nameExpr expr="(((?&lt;=def\s)self.\w+)|((?&lt;=def\s)\w+))" />
Platform information

Notepad++ v7.1 (32-bit) on Windows 10.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open PowerEditor/src/functionList.xml and inspect the Ruby function-list entries around the referenced lines. Update the matching expressions so definitions using self.method receive the intended name while ordinary methods remain recognized, then verify both forms in the editor's function list.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.