Add hash # on line 1, column 1 as comment character

All,

Not everyone uses Xcode as an editor, some actually like things like emacs, vi, bbedit, etc these are usually aware of the standard unix comment character for single line, #

I typically have a line starting line 1, column 1, like

#-*- coding: utf-8; mode: tcl; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- vim:fenc=utf-8:filetype=tcl:et:sw=2:ts=2:sts=2

when Xcode obviously won't recognize this type of line.

This seems like a simple patch to here

swift/utils/vim/syntax/swift.vim

swiftLineComment start="#" end="$" contains=swiftComment,swiftTodo

to then use

#-*- coding: utf-8; mode: swift; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- vim:fenc=utf-8:filetype=swift:et:sw=2:ts=2:sts=2

It would be easier to cut/paste comments from other files without having to strip out # and replace with //

Thanks

GA
we.can.be.heroes@inbox.ru

Vim and emacs both support C style comments just fine. I don't think ease of copy/pasting these comments from non-C style languages is important enough to introduce a weirdly-behaving new comment character.

2 Likes

You might very strongly believe that this should be supported, but your response is inappropriate. You're suggesting making a change to the language which might have far-reaching consequences; if you want to convince others that this change is worth making, you might want to consider the tone and words you use to do so. Personal attacks are not going to get you what you want.


From a technical/process perspective: many languages don't support # as a comment character, whether at the start of a file or not. Adding this to Swift at this point would likely require the feature to meet a pretty high bar, which I'm not sure it does. Adding # for the benefit of a shebang line, perhaps — but add this to support a handful of specific text editors (which support regular // just fine for the same benefit), less likely.

7 Likes