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

Add Fortran language support #300

Closed
Glavin001 opened this issue May 3, 2015 · 3 comments
Closed

Add Fortran language support #300

Glavin001 opened this issue May 3, 2015 · 3 comments

Comments

@Glavin001
Copy link
Owner

@janmolnar has forked Atom Beautify and added a beautifier for Fortran. May be worth taking a look into.
See janbernloehr@a7b5799

@Glavin001 Glavin001 self-assigned this May 3, 2015
@Glavin001 Glavin001 added this to the v0.28.0 milestone May 3, 2015
@janbernloehr
Copy link
Contributor

Please tell me if there is something I should do to make this happen. The current implementation invokes emacs to format the fortran script. In this way I can format code part of legacy projects in a consistent way.

@Glavin001 Glavin001 modified the milestones: v0.29.0, v0.28.0 Jun 1, 2015
@Glavin001
Copy link
Owner Author

You could submit a Pull Request adding Fortran support 😃.

I am still working on the documentation for this. Here's a quick overview.

How to add a Language:

  1. Create a new Language file in https://github.com/Glavin001/atom-beautify/tree/master/src/languages
  2. Configure the new language. Example for JavaScript language: https://github.com/Glavin001/atom-beautify/blob/master/src/languages/javascript.coffee#L8
    • name - name of Language
    • namespace - used as a prefix for scoping the options, such as option indent_size becomes js_indent_size for JavaScript language with namespace js
    • grammars - array of supported grammars. Used with extensions to determine if this file is this language or not. Grammars are prioritized over extensions, such that the grammar JavaScript is recognized before js and the beautifier with the same grammar as the file will be used over another that does not support the grammar and only the extension.
    • extensions - array of extensions, without . (dot), such that .js is js. Used to determine if a file is this language. Useful if there is no supported grammar in Atom for this language.
    • options - I'd recommend looking at https://github.com/Glavin001/atom-beautify/blob/master/src/languages/javascript.coffee#L30 for examples.
  3. Add the language file to the list of language names. For instance, c-sharp.coffee file becomes c-sharp. See https://github.com/Glavin001/atom-beautify/blob/master/src/languages/index.coffee#L21
    Now your Language is available and can be detected and beautifiers can support it.

How to add a Beautifier for a Language

  1. Create a new beautifier subclass in https://github.com/Glavin001/atom-beautify/tree/master/src/beautifiers directory
  2. Implement beautifier:
  3. Add beautifier to list of beautifierNames: https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/index.coffee#L34
  4. Add test example files in https://github.com/Glavin001/atom-beautify/tree/master/examples

I have to go. Let me know if you have any questions!

@Glavin001
Copy link
Owner Author

Published to v0.27.10

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

2 participants