Skip to content

Commit 3db01fb

Browse files
committed
named export + remove this.
Since this is was a module, it remained a module I analyzed these files. All except debugger (updated here) and julia-client (updated in other PR) use named import: File connection.js Found usages (24 usages found) Unclassified usage (17 usages found) lib\runtime (16 usages found) completions.js (1 usage found) 10 import { client } from '../connection' console.js (1 usage found) 3 import { client } from '../connection' datatip.js (1 usage found) 11 import { client } from '../connection' debugger.js (2 usages found) 6 import { client } from '../connection' 7 import connection from '../connection' debuginfo.js (1 usage found) 3 import { client } from '../connection' environments.js (1 usage found) 6 import { client } from '../connection' formatter.js (1 usage found) 4 import { client } from '../connection' frontend.js (1 usage found) 3 import { client } from '../connection' goto.js (1 usage found) 7 import { client } from '../connection' linter.js (1 usage found) 4 import { client } from '../connection' outline.js (1 usage found) 5 import { client } from '../connection' packages.js (1 usage found) 3 import { client } from '../connection' plots.js (1 usage found) 3 import { client } from '../connection' profiler.js (1 usage found) 3 import { client } from '../connection' urihandler.js (1 usage found) 3 import { client } from '../connection' lib\ui (1 usage found) docs.js (1 usage found) 4 import { client } from '../connection' Usage in string literals (7 usages found) lib (1 usage found) julia-client.coffee (1 usage found) 21 connection: require './connection' lib\package (1 usage found) config.coffee (1 usage found) 1 {terminal} = require '../connection' lib\runtime (3 usages found) evaluation.coffee (1 usage found) 5 {client} = require '../connection' modules.coffee (1 usage found) 6 {client} = require '../connection' workspace.coffee (1 usage found) 3 {client} = require '../connection' lib\ui (2 usages found) progress.coffee (1 usage found) 2 {client} = require '../connection' views.coffee (1 usage found) 3 {client} = require '../connection'
1 parent bb8fe70 commit 3db01fb

File tree

2 files changed

+59
-60
lines changed

2 files changed

+59
-60
lines changed

lib/connection.js

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,70 +9,70 @@ import client from './connection/client'
99
import local from './connection/local'
1010
import terminal from './connection/terminal'
1111

12-
export default {
13-
// TODO remove these from the export default and export them directly (prevents expensive copy)
14-
// TODO don't use this.message use message directly (prevents expensive copy)
15-
IPC: IPC,
16-
messages: messages,
17-
client: client,
18-
local: local,
19-
terminal: terminal,
12+
exports.IPC = IPC
13+
exports.messages = messages
14+
exports.client = client
15+
exports.local = local
16+
exports.terminal = terminal
2017

21-
activate() {
22-
this.messages.activate();
23-
this.client.activate();
24-
this.client.boot = () => this.boot();
25-
this.local.activate();
26-
this.booting = false;
27-
},
18+
let booting = false;
19+
let mod_ink; // ink in this module
2820

29-
deactivate() {
30-
this.client.deactivate();
31-
},
21+
export function activate() {
22+
messages.activate();
23+
client.activate();
24+
client.boot = () => boot();
25+
local.activate();
26+
booting = false;
27+
}
3228

33-
consumeInk(ink) {
34-
this.IPC.consumeInk(ink);
35-
this.ink = ink;
36-
},
29+
export function deactivate() {
30+
client.deactivate();
31+
}
3732

38-
consumeGetServerConfig(getconf) {
39-
this.local.consumeGetServerConfig(getconf);
40-
},
33+
export function consumeInk(ink) {
34+
IPC.consumeInk(ink);
35+
mod_ink = ink;
36+
}
4137

42-
consumeGetServerName(name) {
43-
this.local.consumeGetServerName(name);
44-
},
38+
export function consumeGetServerConfig(getconf) {
39+
local.consumeGetServerConfig(getconf);
40+
}
4541

46-
_boot(provider) {
47-
if (!this.client.isActive() && !this.booting) {
48-
this.booting = true;
49-
this.client.setBootMode(provider);
42+
export function consumeGetServerName(name) {
43+
local.consumeGetServerName(name);
44+
}
45+
46+
export function _boot(provider) {
47+
if (!client.isActive() && !booting) {
48+
booting = true;
49+
client.setBootMode(provider);
5050

5151
let p;
5252
if (provider === 'External Terminal') {
5353
p = externalTerminal.connectedRepl();
5454
} else {
55-
p = this.local.start(provider);
55+
p = local.start(provider);
5656
}
5757

58-
if (this.ink) {
59-
this.ink.Opener.allowRemoteFiles(provider === 'Remote');
58+
if (mod_ink) {
59+
mod_ink.Opener.allowRemoteFiles(provider === 'Remote');
6060
}
6161
p.then(() => {
62-
this.booting = false;
62+
booting = false;
6363
});
6464
p.catch(() => {
65-
this.booting = false;
65+
booting = false;
6666
});
67-
return time("Julia Boot", this.client.import('ping')());
67+
return time("Julia Boot", client.import('ping')());
6868
}
69-
},
69+
}
70+
71+
export function bootRemote() {
72+
return _boot('Remote');
73+
}
7074

71-
bootRemote() {
72-
return this._boot('Remote');
73-
},
75+
export function boot() {
76+
return _boot(atom.config.get('julia-client.juliaOptions.bootMode'));
77+
}
7478

75-
boot() {
76-
return this._boot(atom.config.get('julia-client.juliaOptions.bootMode'));
77-
}
78-
};

lib/runtime/debugger.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
import { CompositeDisposable } from 'atom'
55
import { views } from '../ui'
6-
import { client } from '../connection'
7-
import connection from '../connection'
6+
import { client, boot as connection_boot } from '../connection'
87
import { blocks, cells, paths } from '../misc'
98
import modules from './modules'
109

@@ -273,53 +272,53 @@ export function debugBlock(shouldStep, cell) {
273272
}
274273

275274
export function clearbps() {
276-
connection.boot()
275+
connection_boot()
277276
breakpoints.clear()
278277
if (client.isActive()) client.import('clearbps')()
279278
}
280279

281280
function toggleJuliaBP (item) {
282-
connection.boot()
281+
connection_boot()
283282
return client.import('toggleBP')(item)
284283
}
285284
function clearJulia () {
286-
connection.boot()
285+
connection_boot()
287286
return client.import('clearbps')()
288287
}
289288
function toggleUncaughtJulia () {
290-
connection.boot()
289+
connection_boot()
291290
return client.import('toggleUncaught')()
292291
}
293292
function toggleExceptionJulia () {
294-
connection.boot()
293+
connection_boot()
295294
return client.import('toggleException')()
296295
}
297296
function toggleCompiled () {
298-
connection.boot()
297+
connection_boot()
299298
return client.import('toggleCompiled')()
300299
}
301300
function getBreakpoints () {
302-
connection.boot()
301+
connection_boot()
303302
return client.import('getBreakpoints')()
304303
}
305304
function addArgsJulia (args) {
306-
connection.boot()
305+
connection_boot()
307306
return client.import('addArgs')(args)
308307
}
309308
function toggleAllActiveJulia (args) {
310-
connection.boot()
309+
connection_boot()
311310
return client.import('toggleAllActiveBP')(args)
312311
}
313312
function toggleActiveJulia (item) {
314-
connection.boot()
313+
connection_boot()
315314
return client.import('toggleActiveBP')(item)
316315
}
317316
function addCondition (item, cond) {
318-
connection.boot()
317+
connection_boot()
319318
return client.import('addConditionById')(item, cond)
320319
}
321320
function setLevel (level) {
322-
connection.boot()
321+
connection_boot()
323322
return client.import('setStackLevel')(level)
324323
}
325324

0 commit comments

Comments
 (0)