Skip to content

Draft method motions - #230

Open
Ddedalus wants to merge 1 commit into
aioutecism:masterfrom
Ddedalus:motion-methods
Open

Draft method motions#230
Ddedalus wants to merge 1 commit into
aioutecism:masterfrom
Ddedalus:motion-methods

Conversation

@Ddedalus

Copy link
Copy Markdown
Contributor

This one is a bit trickier. I've figured out a way of obtaining information on which methods are where right from the vscode (so the upside is it works for any language which end user has support for).

The problem is it involves an async call and I don't understand the rest of the code well enough to know where to put it. Once a file is loaded, the list is returned really quickly but is still a Thenable :/
It may be reasonable to put a callback when for example the first character of ]m is recognised.

Please have a look and tell if this code is of any use.

@Ddedalus

Copy link
Copy Markdown
Contributor Author

You can see how the motions would work by placing a breakpoing somewhere in the async by looking at the debug log. Method numeration starts at 1.

@aioutecism

Copy link
Copy Markdown
Owner

Will look into this later.

Comment thread src/Motions/Methods.ts
private n: number;

constructor(args: { direction: Direction, n?: number }) {
args.n = args.n === undefined ? 1 : args.n;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be solved a bit cleaner with nullish coalescing, assuming you're using TS 3.7+.

args.n = args.n ?? 1;

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants