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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add python comment #390
Add python comment #390
Conversation
No idea about python and i was forced to disable it in fedora, because libpeas droped python2 report. |
Sorry I don’t understand your comment or know anything about libpeas! Let me know if I should change something |
I only said that i don't use python plugins anymore as fedora maintainer and i am not familiar with python. |
I don't know anything about this, as I don't use any external plugins at all. I see that snippets uses python so should be testable for function but it's not something I normally use so I could miss a subtle problem either in master or after this commit. None the less I have put this on my schedule for testing |
I see that |
Yes, #389 is necessary for the Python plugin to work. Sorry I’m not sure what the correct procedure is for making a second PR that depends on the first one. I wanted this PR to contain working code so included it here too. |
If this PR is merged first, the first one will need to be closed. If the other one is merged first, this one will need a rebase on master and a forced update, almost certainly including manual resolution of a merge conflict. |
I have refactored my contribution to pluma. In my original commits, I added the comment snippet to he Python language in an ad hoc way. In this one, I have refactored the code for toggling comments so that it can be quickly used in snippets for any language. Essentially, you just have to change the comment string for that language - e.g., Sorry if this has made more work for you! But hopefully the code is now easier to review, re-use, maintain etc. |
Actually I’ve just seen how I can very quickly generalise this to all languages. Will add more commits soon |
#389 is merged, you can rebase PR against master. |
@andrewfowlie |
@andrewfowlie - this has a conflict, can you fix it? Also, I get this error when enabling the snippets plugin:
|
it could now be easily used for other languages without code replication
I have fixed the conflict and rebased. Regarding the error, it seems that the pluma/plugins/snippets/snippets/comment.py file isn't being copied to the correct directory by the installer. It should go here /usr/lib/x86_64-linux-gnu/pluma/plugins/snippets/ too. If you want to test the code w/o fixing this installation issue, copy it there manually, or export PYTHONPATH=PATH/TO/pluma/plugins/snippets/snippets/ might also work. |
Lost some files when installing:
|
@yetist , yes, how to fix? |
You can edit the |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works.
Press 'Ctrl-M' can toggle comment/uncomment the current line, if select one or more lines, it can do the same things.
I builds fine and i can start pluma with activated snippet pluging, But crtl+m does nothing in adocument with python code. Beside from that i think commit 3,4,5 are fixes for commit 2, or not ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fine for me. As long as you have the Snippets plugin enabled, pressing <Ctrl>+m
comments the selected line/block.
I agree with @raveit65 about squashing, I think I would squash the entire thing into a single feature commit |
Squashed and merged. |
This adds a snippet to comment/uncomment Python code with
Ctrl+m
.import re
)I think this is a very useful enhancement. It could be quickly generalized to other languges just by changing
#
to//
or whatever, but I'm not sure about how to best achieve that without lots of duplication.