Skip to content
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

Auto inserted colon causes pylint error #1227

Closed
spyder-bot opened this issue Feb 17, 2015 · 6 comments
Closed

Auto inserted colon causes pylint error #1227

spyder-bot opened this issue Feb 17, 2015 · 6 comments

Comments

@spyder-bot
Copy link
Collaborator

From steve.f....@gmail.com on 2013-01-17T15:49:35Z

Spyder Version: 2.2.0beta1
Python Version: 2.7.3
Qt Version: 4.7.4, PyQt4 (API v1) 4.8.6 on Windows

What steps will reproduce the problem?

  1. Create a line with the following text: class SomeTest(unittest.TestCase):#pylint:disable= R0904 2. Place the cursor on that line.
    1. Press enter.
    2. Spyder inserts a colon at the end of the line that causes an error for pylint: E0012: Bad option value ' R0904 :' What is the expected output? What do you see instead? Don't insert the : when it's not needed.

Please provide any additional information below

.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1227

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2013-01-27T04:36:55Z

@-Carlos: I agree with Steve that the automatic colon insertion algorithm should take into account comments. In other words, in CodeEditor.__do_insert_colons, commented parts of 'leadingtext' should be removed in the process... and that is not trivial because it would require a sophisticated text parsing adapted to Python language grammar. Note that such an algorithm would be needed by other parts of Spyder (like the fact that code completion should not be triggered inside a comment).

If you we are not able to provide a mature feature, I think that we should disable it by default.

In other words, I can accept to skip let this Issue opened for v2.2 but in the meantime this means that the feature is still experimental, so we have to disable it by default.

Status: Accepted
Owner: ccordoba12
Labels: Cat-Editor MS-v2.2

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-01-27T06:38:35Z

@-Pierre: This is actually next in my TODO list and I have an idea on how we could solve it in a different way: using syntax highlighting.

The idea would be to detect comments/strings by the color they are highlighted with. If their colors match the ones assigned to them by the current color scheme, then we can be sure about it's syntactical role.

I found some promising code snippets a while back but I was quite busy last semester to study them at depth. After I publish beta2 this afternoon, I'll put my full attention to this problem and I think I can fix it by the next weekend.

If not, then we can disable the feature by default (like you say) and I'll try to fix it during the 2.2 cycle.

Labels: -Priority-Medium Priority-High

@spyder-bot
Copy link
Collaborator Author

From pierre.raybaut on 2013-01-27T07:06:43Z

Funny, I was pretty sure that Qt was not exposing any interface to retrieve the information of text formatting (color, bold, italic, ...) related to syntax highlighting. I thought I already looked into it.

But if it is possible then that's good news indeed.

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-03-30T22:32:30Z

This issue was updated by revision 242294e8afe8 .

Status: Started

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2013-04-05T14:34:08Z

Jed, please help me verify the test case provided by Steve is now working correctly.

@spyder-bot
Copy link
Collaborator Author

From jed.lud...@gmail.com on 2013-04-05T19:34:28Z

Looks like it is working at revision b6204549563f under Windows 7,

Status: Verified

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

No branches or pull requests

1 participant