Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

method motions to include decorators#1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

KamranMaharov
Copy link
Contributor

method motions to include decorators

@diraol
Copy link
Contributor

@KamranMaharov can you rebase against thedevelop branch, so we can see if the tests passes?

@KamranMaharovKamranMaharovforce-pushed themethod_motion_include_decorator branch fromffcb12f to4359924CompareMay 12, 2019 05:22
method motions to include decorators
@KamranMaharovKamranMaharovforce-pushed themethod_motion_include_decorator branch from4359924 tod4aa916CompareMay 12, 2019 05:26
@KamranMaharov
Copy link
ContributorAuthor

@diraol , done.

onoremap <buffer> iM :<C-U>call pymode#motion#select('^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=def<Bslash>s', 1)<CR>
vnoremap <buffer> aM :<C-U>call pymode#motion#select('^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=def<Bslash>s', 0)<CR>
vnoremap <buffer> iM :<C-U>call pymode#motion#select('^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=def<Bslash>s', 1)<CR>
onoremap <buffer> C :<C-U>call pymode#motion#select_c('^<Bslash>s*class<Bslash>s', 0)<CR>
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi@KamranMaharov
Why have you usedselect_c over here?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

good point. it could have beenselect(pattern, pattern)
to not duplicate pattern all over the script (that would be confusing), we call
select_c(pattern) and thenselect_c(pattern) callsselect(pattern, pattern)

vnoremap <buffer> aC :<C-U>call pymode#motion#select_c('^<Bslash>s*class<Bslash>s', 0)<CR>
vnoremap <buffer> iC :<C-U>call pymode#motion#select_c('^<Bslash>s*class<Bslash>s', 1)<CR>

onoremap <buffer> M :<C-U>call pymode#motion#select('^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=@', '^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=def<Bslash>s', 0)<CR>
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't@ be an optional "group"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, for a decorator, we don't useasync before decorators right?
So this:

(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=@

have an extraasync doesn't? [sorry if I didn't understand the regexes correctly].

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

i'm not familiar withasync keyword.
as far as i can tell, it was here before and we could use it for matching decorator pattern.

@diraol
Copy link
Contributor

Also, can you provide a sample code for us to test it?
Eventually you can add the file inside the 'tests' directory with comments on how to test it manually. =)

I'm thinking in adding suchsnippets for us to be able to test the features, even if it is manually (at some point we can automate the test, but writing tests here is not trivial).

python file for testing motions
@KamranMaharov
Copy link
ContributorAuthor

@diraol added sample test file. it is based on the code which you provided for testing.
i just added a little bit.

  • tested again. it's working.

@diraoldiraol merged commitf61b74a intopython-mode:developJun 30, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@diraoldiraoldiraol left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@KamranMaharov@diraol

[8]ページ先頭

©2009-2025 Movatter.jp