Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 59d1bbd

Browse files
committed
new error message about crash
removed julia fork to get default environment
1 parent e4a25b0 commit 59d1bbd

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.DS_Store
22
npm-debug.log
33
node_modules
4+
.package.json.full

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,41 @@ This is a fork that replaces Lint.jl with StaticLint.jl from the Julia VSCode pl
1313
* julia-1.5.3
1414
* [linter-ui-default](https://atom.io/packages/linter-ui-default)
1515
* [linter](https://atom.io/packages/linter)
16-
* tested on ubuntu 18.04 and Windows
16+
* tested on Ubuntu 18.04 and Windows
1717

1818
## Caveats
1919

2020
* The server needs a minute to spin up, then also some time to parse new Julia environments that this Atom instance
21-
have not seen before. A pop-up is shown when parsing the environment starts, but not when it ends. After that, you need to
22-
edit or reopen the files already in editing for linting to start. If the environment had been already parsed, linting new files is immediate.
21+
have not seen before. A pop-up is shown when parsing a new environment starts (but not when it ends). After parsing finishes, you need to
22+
edit or reopen those files that are already in the editor for linting to start. If the environment had been already parsed, linting new files is immediate.
2323
* The edited file has to be saved at least once for linting to start. This is by design of the linter package (https://github.com/steelbrain/linter/issues/1235)
2424
* The environment for each file is guessed from its path. If this fails, Julia's default environment is assumed.
2525
* The symbols are rebuilt if the modification time of the Project.toml or the Manifest.toml files change, for example,
2626
you add, remove or update packages. Linting is not available during this rebuild.
27-
* It works on Windows, but does not shuts down correctly.
27+
* It works on Windows, but the Julia server does not shuts down on its own there (yet).
2828

2929
## Internals
3030

31-
I know nothing of Atom development or js, so the changes are likely messy there, please revise. Atom seems to be
32-
unable to shut down the server process, so the server exits by polling Atom's PID right now. This does not work on Windows yet.
33-
3431
The code generates its private shared environment at the Julia depot in 'environments/linter-julia'. It also places a logfile there.
3532

3633
Guessing the environment works by walking upwards in the path and looking for Project.toml. If nothing found, the default
3734
environment is assumed. The project's root file is then looked for at the canonical X/src/X.jl etc. locations.
3835

36+
I know nothing of Atom development or js, so the changes are likely messy there, please revise. Atom seems to be
37+
unable to shut down the server process, so the server exits by polling Atom's PID right now. This does not work on Windows yet.
38+
3939
## Installation
4040

4141
- Install the package through Atom's UI. You can also use the `apm` tool in the CLI:
4242
```bash
4343
$ apm install takbal/linter-julia
4444
```
4545

46-
- You may need to tell linter-julia where to find the julia executable
46+
- You may need to tell linter-julia where to find the Julia executable
4747
(i.e. `/usr/bin/julia` or `C:\Julia-1.5.3\bin\julia.exe`). The default assumes 'julia' just works.
4848

49+
- Julia must have the General registry added.
50+
4951
## Settings
5052

5153
![screenshot](https://raw.githubusercontent.com/AtomLinter/linter-julia/master/settings.png)

lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function activate() {
6262
}
6363
*/
6464
if (global.linter_julia_started) {
65-
atom.notifications.addInfo('linter-julia: please restart Atom for this change to work');
65+
atom.notifications.addInfo('[Linter-Julia] please restart Atom for this change to work');
6666
}
6767
}),
6868
atom.config.observe('linter-julia.ignoreInfo', (value) => {
@@ -143,10 +143,10 @@ export function provideLinter() {
143143
try {
144144
parsed = JSON.parse(merged);
145145
} catch (_) {
146-
const msg = '[Linter-Julia] Server returned non-JSON response';
147-
atom.notifications.addError(`${msg}. See console for more info`);
146+
atom.notifications.addError(`[Linter-Julia] server has likely crashed. Please check symbolserver.log.${process.pid}
147+
in the "linter-julia" shared Julia environment, and restart Atom.`);
148148
// eslint-disable-next-line no-console
149-
console.error(`${msg}: `, merged);
149+
console.error('server returned: ', merged);
150150
resolve(null);
151151
return;
152152
}

lib/julia-server.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ using Pkg, Sockets, Serialization, Logging
22

33
import Base.Threads.@spawn
44

5+
# assumes the julia executable starts in the default environment
6+
const default_env = dirname(Pkg.project().path)
7+
58
# both this script and the symbol server is going to use this shared environment
69
Pkg.activate("linter-julia", shared=true)
710

@@ -28,9 +31,6 @@ needed_packages = Dict(
2831
return(String(take!(buffer)))
2932
end
3033

31-
# if you know a better way of getting the default Julia environment, please tell ...
32-
const julia_exec = joinpath(Sys.BINDIR, Base.julia_exename())
33-
const default_env = strip(read(`$julia_exec --startup-file=no -e "using Pkg; println(dirname(Pkg.project().path))"`, String))
3434
const store_location = dirname(Pkg.project().path)
3535
const port = ARGS[1]
3636
const atom_pid = parse(Int32, split(port,"_")[end])
@@ -448,9 +448,12 @@ end
448448
try
449449
server = listen(port)
450450

451-
# # this is looping until Atom dies
451+
# this is looping until Atom dies
452452
while true
453453
conn = accept(server)
454+
# there isn't too much point in @spawn this: only the server generation is slow, and that is MT anyway
455+
# you would also need to add more threads that are not going do too much all of the time
456+
# but you may get weird race conditions
454457
@async handle_connection(conn)
455458
end
456459

0 commit comments

Comments
 (0)