├── .gitignore
├── images
├── screenshot.png
└── fortls_log_ex.png
├── .travis.yml
├── LICENSE.md
├── CHANGELOG.md
├── README.md
├── package.json
└── lib
└── main.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 |
--------------------------------------------------------------------------------
/images/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hansec/ide-fortran/HEAD/images/screenshot.png
--------------------------------------------------------------------------------
/images/fortls_log_ex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hansec/ide-fortran/HEAD/images/fortls_log_ex.png
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 |
3 | notifications:
4 | email:
5 | on_success: never
6 | on_failure: change
7 |
8 | script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh'
9 |
10 | git:
11 | depth: 10
12 |
13 | branches:
14 | only:
15 | - master
16 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017-2018 Chris Hansen
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.4.0
2 | * Add support for language server v1.7 features
3 | * Update README to reflect full release of language server
4 |
5 | ## 0.3.0
6 | * Use signatureHelp by default
7 | * Bump recommended minimum language server version to 0.8.1
8 |
9 | ## 0.2.3
10 | * Add support for variable_hover language server option
11 | * Bump recommended minimum language server version to 0.7.1
12 |
13 | ## 0.2.2
14 | * Add support for signatureHelp requests
15 | * Bump recommended minimum language server version to 0.7.0
16 |
17 | ## 0.2.1
18 | * Add automatic language server version check when package loads
19 |
20 | ## 0.2.0
21 | * Use incremental sync by default
22 | * Do not filter autocomplete suggestions by default
23 | * Add support for setting intrinsic case
24 | * Bump recommended language server version to 0.6.0
25 | * Remove shell-env dependency
26 |
27 | ## 0.1.9
28 | * Fix support for disabling language server prefix filtering
29 |
30 | ## 0.1.8
31 | * Add support for disabling language server prefix filtering
32 | * Bump recommended language server version to 0.4.0
33 |
34 | ## 0.1.7
35 | * Fix bug where "language server outdated" warnings setting was not used
36 |
37 | ## 0.1.6
38 | * Fix bug that may cause Atom to hang when using ide-fortran on Linux [#6](https://github.com/hansec/ide-fortran/issues/6)
39 | * Bump recommended language server version to 0.3.6
40 |
41 | ## 0.1.5
42 | * Add warning when underlying language server is out of date. Initial warning at version 0.3.3
43 |
44 | ## 0.1.4
45 | * Bump package dependencies
46 |
47 | ## 0.1.3
48 | * Fix "Uncaught ReferenceError" when language server fails to start [#3](https://github.com/hansec/ide-fortran/issues/3)
49 |
50 | ## 0.1.2
51 | * Add support for "symbol_skip_mem" language server option
52 | * Add support for "incremental_sync" language server option
53 |
54 | ## 0.1.1
55 | * Add option to produce some debug information
56 |
57 | ## 0.1.0 - First Release
58 | * Initial release
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # IDE-FORTRAN package
2 | [](https://travis-ci.org/hansec/ide-fortran)
3 | [](https://david-dm.org/hansec/ide-fortran)
4 | [](https://atom.io/packages/ide-fortran)
5 | [](https://atom.io/packages/ide-fortran)
6 |
7 | Fortran language support for Atom-IDE, powered by the [Fortran Language Server](https://github.com/hansec/fortran-language-server).
8 |
9 | ## Features
10 |
11 | * Document outline
12 | * [Completion](https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_autocomplete.gif)
13 | * [Signature help](https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_sigHelp.gif)
14 | * [GoTo/Peek definition](https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_gotodef.gif)
15 | * GoTo implementation
16 | * [Hover](https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_hover.gif)
17 | * [Find/Peek references](https://raw.githubusercontent.com/hansec/fortran-language-server/master/images/fortls_refs.png)
18 | * Project-wide symbol search
19 | * Symbol renaming
20 | * Documentation parsing ([Doxygen](http://www.doxygen.org/) and [FORD](https://github.com/Fortran-FOSS-Programmers/ford) styles)
21 | * Diagnostics
22 | - Multiple definitions with the same variable name
23 | - Variable definition masks definition from parent scope
24 | - Missing subroutine/function arguments
25 | - Unknown user-defined type used in "TYPE"/"CLASS" definition (only if visible in project)
26 | - Unclosed blocks/scopes
27 | - Invalid scope nesting
28 | - Unknown modules in "USE" statement
29 | - Unimplemented deferred type-bound procedures
30 | - Use of unimported variables/objects in interface blocks
31 | - Statement placement errors ("CONTAINS", "IMPLICIT", "IMPORT")
32 |
33 | See [Fortran Language Server](https://github.com/hansec/fortran-language-server) for examples and more details. There is also a [companion package](https://marketplace.visualstudio.com/items?itemName=hansec.fortran-ls) for [Visual Studio Code](https://code.visualstudio.com/).
34 |
35 | **Note:** If you are already using the [autocomplete-fortran](https://atom.io/packages/autocomplete-fortran) package
36 | disable it or you will see multiple copies of suggestions in auto completion.
37 |
38 | 
39 |
40 | ## Requirements
41 | This package requires the following packages to be installed:
42 | * [atom-ide-ui](https://atom.io/packages/atom-ide-ui)
43 | * [language-fortran](https://atom.io/packages/language-fortran)
44 |
45 | Additionally, you must have [Python](https://www.python.org/) and the
46 | [Fortran Language Server](https://github.com/hansec/fortran-language-server) installed
47 | on your system.
48 |
49 | This package has been tested and *should* work on :apple: macOS (OS X), :penguin: Linux and Windows.
50 |
51 | ## Configuration
52 |
53 | See the [fortran-language-server README](https://github.com/hansec/fortran-language-server/blob/master/README.rst) for
54 | information on project specific configuration settings.
55 |
56 | ## Bug reports
57 | Note that most bugs observed with this package are actually related to the upstream
58 | [fortran-language-server](https://github.com/hansec/fortran-language-server). Unless you believe the error
59 | you observe is directly related to Atom please submit issues to the
60 | [upstream repo](https://github.com/hansec/fortran-language-server/issues/new). When filing bugs please
61 | provide example code to reproduce the observed issue if possible.
62 |
63 | ## License
64 | MIT License. See [the license](LICENSE.md) for more details.
65 |
66 | ## Support
67 |
68 | If you *really* like [ide-fortran](https://atom.io/packages/ide-fortran) or the underlying [language server](https://github.com/hansec/fortran-language-server) you can buy me a :coffee: or a :beer: to say thanks.
69 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ide-fortran",
3 | "main": "./lib/main",
4 | "version": "0.4.0",
5 | "description": "Fortran language support for Atom-IDE.",
6 | "keywords": [
7 | "FORTRAN",
8 | "autocomplete",
9 | "ide"
10 | ],
11 | "repository": "https://github.com/hansec/ide-fortran",
12 | "license": "MIT",
13 | "engines": {
14 | "atom": ">=1.21.0"
15 | },
16 | "dependencies": {
17 | "atom-languageclient": "^0.9.0"
18 | },
19 | "enhancedScopes": [
20 | "source.fortran.free",
21 | "source.fortran.fixed"
22 | ],
23 | "configSchema": {
24 | "fortlsPath": {
25 | "title": "Fortran Language Server Path",
26 | "order": 1,
27 | "type": "string",
28 | "default": "fortls",
29 | "description": "Absolute path to ```fortls``` executable."
30 | },
31 | "include_symbol_mem": {
32 | "type": "boolean",
33 | "default": true,
34 | "order": 2,
35 | "title": "Type member symbols",
36 | "description": "Include type members in document outline"
37 | },
38 | "autocomplete_prefix": {
39 | "type": "boolean",
40 | "default": false,
41 | "order": 3,
42 | "title": "Filter autocomplete suggestions",
43 | "description": "Filter autocomplete suggestions with variable prefix"
44 | },
45 | "lowercase_intrinsics": {
46 | "type": "boolean",
47 | "default": false,
48 | "order": 4,
49 | "title": "Lowercase intrinsics",
50 | "description": "Use lowercase for intrinsics and keywords in autocomplete requests"
51 | },
52 | "incremental_sync": {
53 | "type": "boolean",
54 | "default": true,
55 | "order": 5,
56 | "title": "Incremental Synchronization",
57 | "description": "Use incremental synchronization for file changes"
58 | },
59 | "variable_hover": {
60 | "type": "boolean",
61 | "default": false,
62 | "order": 6,
63 | "title": "Variable hover",
64 | "description": "Show hover information for variables"
65 | },
66 | "use_signature_help": {
67 | "type": "boolean",
68 | "default": true,
69 | "order": 7,
70 | "title": "Signature Help",
71 | "description": "Use signature help instead of snippets when available"
72 | },
73 | "notify_init": {
74 | "type": "boolean",
75 | "default": false,
76 | "order": 8,
77 | "title": "Initialization notifications",
78 | "description": "Notify when workspace initialization is complete (requires v1.7.0+)"
79 | },
80 | "debug": {
81 | "type": "boolean",
82 | "default": false,
83 | "order": 9,
84 | "title": "Debugging",
85 | "description": "Provides some debug notifications such as Language Server launch and close"
86 | },
87 | "displayVerWarning": {
88 | "type": "boolean",
89 | "default": true,
90 | "order": 10,
91 | "title": "Display warnings when fortls is outdated",
92 | "description": "Provides notification when the underlying ```fortran-language-server``` is out of date"
93 | }
94 | },
95 | "consumedServices": {
96 | "linter-indie": {
97 | "versions": {
98 | "2.0.0": "consumeLinterV2"
99 | }
100 | },
101 | "datatip": {
102 | "versions": {
103 | "0.1.0": "consumeDatatip"
104 | }
105 | },
106 | "signature-help": {
107 | "versions": {
108 | "0.1.0": "consumeSignatureHelp"
109 | }
110 | }
111 | },
112 | "providedServices": {
113 | "autocomplete.provider": {
114 | "versions": {
115 | "2.0.0": "provideAutocomplete"
116 | }
117 | },
118 | "code-format.range": {
119 | "versions": {
120 | "0.1.0": "provideCodeFormat"
121 | }
122 | },
123 | "code-highlight": {
124 | "versions": {
125 | "0.1.0": "provideCodeHighlight"
126 | }
127 | },
128 | "definitions": {
129 | "versions": {
130 | "0.1.0": "provideDefinitions"
131 | }
132 | },
133 | "find-references": {
134 | "versions": {
135 | "0.1.0": "provideFindReferences"
136 | }
137 | },
138 | "outline-view": {
139 | "versions": {
140 | "0.1.0": "provideOutlines"
141 | }
142 | }
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/lib/main.js:
--------------------------------------------------------------------------------
1 | /* --------------------------------------------------------------------------------------------
2 | * Copyright (c) Chris Hansen. All rights reserved.
3 | * Licensed under the MIT License. See License.md in the project root for license information.
4 | * ------------------------------------------------------------------------------------------ */
5 | const cp = require('child_process')
6 | const https = require('https')
7 | const {AutoLanguageClient} = require('atom-languageclient')
8 |
9 | async function checkVersion() {
10 | async function checkVersionLocal(rec_ver_str="1.7.2") {
11 | function compareSymantic(ver, rec_ver) {
12 | for (var index = 0; index < rec_ver.length; ++index) {
13 | if (parseInt(ver[index]) < parseInt(rec_ver[index])) {
14 | return true
15 | } else if (parseInt(ver[index]) > parseInt(rec_ver[index])) {
16 | return false
17 | }
18 | }
19 | return false
20 | }
21 | const childProcess = cp.spawn(atom.config.get("ide-fortran.fortlsPath"), ["--version"])
22 | childProcess.stdout.on('data', (data) => {
23 | let ver_str = data.toString().trim()
24 | if (compareSymantic(ver_str.split("."), rec_ver_str.split("."))) {
25 | atom.notifications.addWarning(`IDE-Fortran: A newer version (${rec_ver_str}) of "fortls" is available.`,
26 | {
27 | dismissable: true,
28 | buttons: [{
29 | text: "Disable warning",
30 | onDidClick: () => atom.workspace.open("atom://config/packages/ide-fortran")
31 | }],
32 | description: "Please update `fortran-language-server` on your system. You may disable this warning in settings."
33 | })
34 | }
35 | })
36 | }
37 | https.get('https://pypi.org/pypi/fortran-language-server/json', (resp) => {
38 | let data = ''
39 | // A chunk of data has been recieved
40 | resp.on('data', (chunk) => { data += chunk } )
41 | // The whole response has been received, check version
42 | resp.on('end', () => {
43 | try {
44 | let package_data = JSON.parse(data)
45 | checkVersionLocal(package_data.info.version)
46 | } catch (e) {
47 | checkVersionLocal()
48 | }
49 | })
50 | }).on("error", (err) => { checkVersionLocal() } )
51 | }
52 |
53 | class FortranLanguageClient extends AutoLanguageClient {
54 | getGrammarScopes () { return [ 'source.fortran.free', 'source.fortran.fixed' ] }
55 | getLanguageName () { return 'Fortran' }
56 | getServerName () { return 'fortls' }
57 |
58 | constructor(serializedState) {
59 | super(serializedState)
60 | if (atom.config.get("ide-fortran.displayVerWarning")) { checkVersion() }
61 | }
62 |
63 | async startServerProcess (projectPath) {
64 | if (atom.config.get("ide-fortran.debug")) { atom.notifications.addInfo("IDE-Fortran: Starting fortls") }
65 | let args = []
66 | if (!atom.config.get("ide-fortran.include_symbol_mem")) { args.push("--symbol_skip_mem") }
67 | if (atom.config.get("ide-fortran.incremental_sync")) { args.push("--incrmental_sync") }
68 | if (!atom.config.get("ide-fortran.autocomplete_prefix")) { args.push("--autocomplete_no_prefix") }
69 | if (atom.config.get("ide-fortran.lowercase_intrinsics")) { args.push("--lowercase_intrinsics") }
70 | if (atom.config.get("ide-fortran.use_signature_help")) { args.push("--use_signature_help") }
71 | if (atom.config.get("ide-fortran.variable_hover")) { args.push("--variable_hover") }
72 | if (atom.config.get("ide-fortran.notify_init")) { args.push("--notify_init") }
73 | const childProcess = cp.spawn(atom.config.get("ide-fortran.fortlsPath"), args,
74 | {
75 | cwd: projectPath
76 | })
77 | childProcess.on("error", err =>
78 | atom.notifications.addError("Unable to start the Fortran language server.",
79 | {
80 | dismissable: true,
81 | buttons: [{
82 | text: "Install Instructions",
83 | onDidClick: () => atom.workspace.open("atom://config/packages/ide-fortran")
84 | }],
85 | description: "This can occur if you do not have Python installed or if it is not in your path.\n\n Also, make sure to install `fortls` by running:\n```\npip install fortran-language-server\n```"
86 | })
87 | )
88 | childProcess.on('exit', exitCode => {
89 | if (exitCode == 0 || exitCode == null) {
90 | if (atom.config.get("ide-fortran.debug")) { atom.notifications.addInfo("IDE-Fortran: Stopping fortls") }
91 | } else {
92 | atom.notifications.addError('IDE-Fortran: language server stopped unexpectedly.',
93 | {
94 | dismissable: true,
95 | description: this.processStdErr != null ? `${this.processStdErr}` : `Exit code ${exitCode}`
96 | })
97 | }
98 | })
99 | if (atom.config.get("ide-fortran.debug")) {
100 | childProcess.stderr.on('data', (data) => {
101 | console.log(`SERVER(fortls)-stderr: ${data}`);
102 | })
103 | }
104 | return childProcess
105 | }
106 | }
107 |
108 | module.exports = new FortranLanguageClient()
109 |
--------------------------------------------------------------------------------