dparkins/language-fortran

A line starting with (!) is not recognized as a comment in .f files

guziy opened this issue · 2 comments

guziy commented

Hi:

Here is the example code

      program test
!this is a comment
c no this is a comment
        print *, 'Hello' 
      end

And here is how it looks in the editor:

screen shot 2015-07-27 at 10 44 51

Is it possible to configure this to treat (!) - as a comment start in .f files as well?

Cheers

The grammar is treating the .f file as adhering to a different Fortran standard, the Fortran 1977 standard to be exact, where ! is not recognized as a comment marker. You should be able to force Atom to apply the "modern" Fortran grammar to .f files by modifying your init.coffee file as discussed here. For your case try

path = require 'path'

atom.workspace.observeTextEditors (editor) ->
    if path.extname(editor.getPath()) in [".f"]
        editor.setGrammar(atom.grammars.grammarForScopeName('source.fortran.modern'))
guziy commented

Thanks Tom:

It works very nicely.

Cheers