Bug 347449

Summary: Attempting to parse non-python files
Product: [Developer tools] kdev-python Reporter: Francis Herne <mail>
Component: Language supportAssignee: Sven Brauch <mail>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version First Reported In: 1.7.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Francis Herne 2015-05-08 22:22:27 UTC
The project I'm working on has some files with a ".pynml" extension. These don't contain valid python code, so parsing them is pointless and leads to error underlinings and randomly highlighted areas.

Doesn't seem to be a mimetype issue - 'file name.pynml' gives simply "name.pynml: ASCII text" compared to "name.py:  Python script, ASCII text executable" for an actual python file.

Possibly it's incorrectly matching the start of the suffix?

Reproducible: Always

Steps to Reproduce:
1. Have a file named *.pynml (or presumably *.py*)
2. Open it in KDevelop with kdev-python installed

Actual Results:  
kdev-python attempts to parse file, produces nonsensical highlighting and errors

Expected Results:  
kdev-python ignores non-python file and doesn't attempt to parse it
Comment 1 Francis Herne 2015-05-08 22:24:27 UTC
Remembering to check the actual mimetypes, it's text/plain vs text/x-python.
Comment 2 Sven Brauch 2015-05-08 23:31:40 UTC
Hmm. Strange, it should only parse files with mimetype text/x-python. It also does this correctly for me:

kdevplatform (language) KDevelop::BackgroundParserPrivate::createParseJob: found no languages for url KUrl("file:///tmp/test.pynml")
Comment 3 Francis Herne 2015-05-09 00:47:18 UTC
Odd.
Files in question: https://dev.openttdcoop.org/projects/road-hog/repository/show/src/templates
Comment 4 Sven Brauch 2015-10-08 18:28:52 UTC
I could never reproduce this, if it still exists, please reopen
Comment 5 Francis Herne 2016-03-04 17:23:17 UTC
Sorry, looking at the same problem now it seems to be caused by the C++ parser, so I was probably mistaken when filing this.

Re-filed against the C++ parser as https://bugs.kde.org/show_bug.cgi?id=360081