Skip to content

Commit 1460c80

Browse files
committed
chore: upgrade dependencies to the latest versions
Also fix some TypeScript errors
1 parent 57ea358 commit 1460c80

File tree

3 files changed

+904
-658
lines changed

3 files changed

+904
-658
lines changed

lib/datatip-manager.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class DataTipManager {
9393
this.subscriptions.add(
9494
atom.workspace.observeTextEditors((editor) => {
9595
const disposable = this.watchEditor(editor)
96-
editor.onDidDestroy(() => disposable.dispose())
96+
editor.onDidDestroy(() => disposable?.dispose())
9797
}),
9898
atom.commands.add("atom-text-editor", {
9999
"datatip:toggle": (evt) => this.onCommandEvt(evt),
@@ -136,7 +136,6 @@ export class DataTipManager {
136136

137137
/**
138138
* returns the provider registry as a consumable service
139-
* @return {ProviderRegistry<DatatipProvider>} [description]
140139
*/
141140
get datatipService() {
142141
return this.providerRegistry
@@ -184,7 +183,7 @@ export class DataTipManager {
184183
* it has been decided to track this instance
185184
* @param editor the Atom Text editor instance to be tracked
186185
*/
187-
updateCurrentEditor(editor: TextEditor) {
186+
updateCurrentEditor(editor: TextEditor | null) {
188187
if (editor === this.editor) {
189188
return
190189
}
@@ -198,7 +197,7 @@ export class DataTipManager {
198197
this.editor = null
199198
this.editorView = null
200199

201-
if (!atom.workspace.isTextEditor(editor)) {
200+
if (editor == null || !atom.workspace.isTextEditor(editor)) {
202201
return
203202
}
204203

@@ -221,7 +220,7 @@ export class DataTipManager {
221220
this.unmountDataTip()
222221
}),
223222
new Disposable(() => {
224-
this.editorView.removeEventListener("mousemove", this.onMouseMoveEvt)
223+
this.editorView?.removeEventListener("mousemove", this.onMouseMoveEvt)
225224
})
226225
)
227226
}
@@ -243,7 +242,7 @@ export class DataTipManager {
243242
const editor = evt.cursor.editor
244243
const position = evt.cursor.getBufferPosition()
245244
if (this.currentMarkerRange === null || !this.currentMarkerRange.containsPoint(position)) {
246-
this.showDataTip(editor, position, evt)
245+
this.showDataTip(editor, position)
247246
}
248247
},
249248
this.hoverTime,
@@ -261,7 +260,7 @@ export class DataTipManager {
261260

262261
this.mouseMoveTimer = setTimeout(
263262
(evt) => {
264-
if (this.editorView === null) {
263+
if (this.editorView == null || this.editor == null) {
265264
return
266265
}
267266

@@ -286,7 +285,7 @@ export class DataTipManager {
286285

287286
const point = this.editor.bufferPositionForScreenPosition(screenPosition)
288287
if (this.currentMarkerRange === null || !this.currentMarkerRange.containsPoint(point)) {
289-
this.showDataTip(this.editor, point, evt)
288+
this.showDataTip(this.editor, point)
290289
}
291290
},
292291
this.hoverTime,
@@ -306,7 +305,7 @@ export class DataTipManager {
306305
* the central command event handler
307306
* @param evt command event
308307
*/
309-
onCommandEvt(evt: CommandEvent) {
308+
onCommandEvt(evt: CommandEvent<TextEditorElement>) {
310309
const editor = evt.currentTarget.getModel()
311310

312311
if (atom.workspace.isTextEditor(editor)) {
@@ -317,7 +316,7 @@ export class DataTipManager {
317316
return this.unmountDataTip()
318317
}
319318

320-
this.showDataTip(editor, position, undefined)
319+
this.showDataTip(editor, position)
321320
}
322321
}
323322

@@ -331,12 +330,11 @@ export class DataTipManager {
331330
async showDataTip(
332331
editor: TextEditor,
333332
position: Point,
334-
evt: CursorPositionChangedEvent | MouseEvent | null
335333
): Promise<void> {
336334
try {
337335
let datatip: Datatip | null = null
338336
for (const provider of this.providerRegistry.getAllProvidersForEditor(editor)) {
339-
const providerTip = await provider.datatip(editor, position, evt)
337+
const providerTip = await provider.datatip(editor, position)
340338
if (providerTip) {
341339
datatip = providerTip
342340
break
@@ -473,19 +471,19 @@ export class DataTipManager {
473471
disposables.add(new Disposable(() => overlayMarker.destroy()))
474472

475473
view.element.addEventListener("mouseenter", () => {
476-
this.editorView.removeEventListener("mousemove", this.onMouseMoveEvt)
474+
this.editorView?.removeEventListener("mousemove", this.onMouseMoveEvt)
477475
})
478476

479477
view.element.addEventListener("mouseleave", () => {
480-
this.editorView.addEventListener("mousemove", this.onMouseMoveEvt)
478+
this.editorView?.addEventListener("mousemove", this.onMouseMoveEvt)
481479
})
482480

483481
// TODO move this code to atom-ide-base
484482
view.element.addEventListener("mousewheel", this.onMouseWheel, { passive: true })
485483

486484
disposables.add(
487485
new Disposable(() => {
488-
this.editorView.addEventListener("mousemove", this.onMouseMoveEvt)
486+
this.editorView?.addEventListener("mousemove", this.onMouseMoveEvt)
489487
view.destroy()
490488
})
491489
)

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@
2828
"busy-signal"
2929
],
3030
"dependencies": {
31-
"atom-package-deps": "^7.1.0",
32-
"atom-ide-base": "^2.1.1"
31+
"atom-ide-base": "^2.1.1",
32+
"atom-package-deps": "^7.1.0"
3333
},
3434
"devDependencies": {
3535
"@types/atom": "^1.40.7",
36-
"@types/node": "^14.14.2",
37-
"atom-languageclient": "^1.0.0",
38-
"@types/jasmine": "^3.5.14",
39-
"atom-jasmine3-test-runner": "^5.1.4",
40-
"typescript": "^4.0.3",
41-
"tslib": "^2.0.3",
42-
"prettier": "^2.1.2",
43-
"eslint": "7.11.0",
44-
"eslint-config-atomic": "^1.5.0",
36+
"@types/jasmine": "^3.6.3",
37+
"@types/node": "^14.14.22",
38+
"atom-jasmine3-test-runner": "^5.1.8",
39+
"atom-languageclient": "^1.0.6",
40+
"build-commit": "^0.1.4",
41+
"cross-env": "latest",
42+
"eslint": "7.18.0",
43+
"eslint-config-atomic": "^1.5.1",
44+
"npm-check-updates": "^11.0.2",
45+
"prettier": "^2.2.1",
4546
"rollup": "^2.38.0",
4647
"rollup-plugin-atomic": "^2.0.1",
47-
"shx": "^0.3.2",
48-
"cross-env": "latest",
49-
"npm-check-updates": "^9.1.2",
50-
"build-commit": "^0.1.1"
48+
"shx": "^0.3.3",
49+
"tslib": "^2.1.0",
50+
"typescript": "^4.1.3"
5151
},
5252
"atomTestRunner": "./spec/runner",
5353
"activationHooks": [

0 commit comments

Comments
 (0)