Bug 160823

Summary: # in first line should be interpreted as shell
Product: [Applications] kate Reporter: Philip Ashmore <contact>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: wishlist CC: cullmann
Priority: NOR Keywords: triaged
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Disables unconditional interpretation of "#" as a comment marker.

Description Philip Ashmore 2008-04-14 15:04:21 UTC
Version:            (using KDE 3.5.9)
Installed from:    Fedora RPMs
OS:                Linux

In Lua, if the "#" symbol occurs on the first line of the file it specifies the shell program to use, when run from a shell interpreter like bash, and the line is interpreted as a comment and ignored by Lua.

Otherwise, the "#" symbol is used to represent the length property of the following table or string variable - not a comment.
Comment 1 Philip Ashmore 2008-04-14 15:06:58 UTC
Created attachment 24325 [details]
Disables unconditional interpretation of "#" as a comment marker.

I don't know enough about Kate syntax highlighting to specify that a "#" on the
first line marks the entire line as a comment.
Comment 2 Dominik Haumann 2008-04-14 18:27:48 UTC
> [...] a "#" on the first line marks the entire line as a comment. 

Maybe we should extend the syntax highlighting system to support line="N" ? We have column="N" already. The use case is mostly only for a special line in interpreted scripts.
Comment 3 Anders Lund 2008-04-14 21:07:07 UTC
Other scripting languages solves this by looking for the shebang line in the 
first context, then moving for a different context for the main loop.
Comment 4 Dominik Haumann 2008-04-15 15:30:06 UTC
Indeed, then it does not really make sense to extend the system.
Comment 5 Sebastian Pipping 2008-10-24 21:50:20 UTC
This seems to be 50% fixed: in the current version of the highlighter "#" is not starting comments.  The shebang line seems not correctly highlighted to me though.
Comment 6 Christoph Cullmann 2010-02-20 15:05:37 UTC
Moving to wish list status. All highlightings works with heuristics and will
never be perfect. Perhaps somebody can provide a patch, therefor not closing
it.
Comment 7 Dominik Haumann 2011-08-12 09:27:29 UTC
Git commit af43905a60c068efa20dee851581207ff2b6a2b3 by Dominik Haumann.
Committed on 12/08/2011 at 11:26.
Pushed by dhaumann into branch 'master'.

highlight #!/... in 1st line correctly

BUG: 160823

M  +5    -1    part/syntax/data/lua.xml

http://commits.kde.org/kate/af43905a60c068efa20dee851581207ff2b6a2b3
Comment 8 Dominik Haumann 2011-08-12 09:27:51 UTC
Git commit f4f537c92a979f58df24dbc55c75262dc7f544ec by Dominik Haumann.
Committed on 12/08/2011 at 11:26.
Pushed by dhaumann into branch 'KDE/4.7'.

highlight #!/... in 1st line correctly

BUG: 160823

M  +5    -1    part/syntax/data/lua.xml

http://commits.kde.org/kate/f4f537c92a979f58df24dbc55c75262dc7f544ec
Comment 9 Dominik Haumann 2012-02-16 13:44:43 UTC
revert shebang highlighting, breaks other languages that include this language 

the only true fix is to add an attribute "firstLine=true/false" to the highlighting. 

http://quickgit.kde.org/?p=kate.git&a=commit&h=e567aff68c0809caaf56376eeb81f64a65b51ab1
Comment 10 Christoph Cullmann 2012-10-30 09:28:35 UTC
We can't maintain more than 200 hls on our own, please provide a patch and reopen then ;) Documentation about highlighings see in our docs.
Comment 11 Dominik Haumann 2012-10-30 09:40:11 UTC
> Other scripting languages solves this by looking for the shebang line in the 
> first context, then moving for a different context for the main loop.

This won't be an option, since our highlighters include others via IncludeRules. And adding a start context for this will always lead to a problem here. This is the main reason why we won't fix this, sorry.
Comment 12 Andrew Crouthamel 2018-09-23 02:31:24 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Andrew Crouthamel 2018-10-27 02:24:49 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!