Skip to content

Commit 084df3a

Browse files
committed
refactor: clean-up module augments
1 parent 0c2154c commit 084df3a

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

lib/adapters/notifications-adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
ShowMessageParams,
66
ShowMessageRequestParams,
77
} from "../languageclient"
8-
import { Notification, NotificationOptions, NotificationExt } from "atom"
8+
import { Notification, NotificationOptions } from "atom"
99

1010
export interface NotificationButton {
1111
text: string
@@ -109,7 +109,7 @@ function addNotificationForMessage(
109109
message: string,
110110
options: NotificationOptions
111111
): Notification | null {
112-
function isDuplicate(note: NotificationExt): boolean {
112+
function isDuplicate(note: Notification): boolean {
113113
const noteDismissed = note.isDismissed && note.isDismissed()
114114
const noteOptions = (note.getOptions && note.getOptions()) || {}
115115
return (

lib/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { join, resolve } from "path"
22
import { existsSync } from "fs"
3-
import { Point, TextBuffer, TextEditor, TextEditorExt, Range, BufferScanResult } from "atom"
3+
import { Point, TextBuffer, TextEditor, Range, BufferScanResult } from "atom"
44
import { CancellationToken, CancellationTokenSource } from "vscode-jsonrpc"
55

66
export type ReportBusyWhile = <T>(title: string, f: () => Promise<T>) => Promise<T>
@@ -10,7 +10,7 @@ export type ReportBusyWhile = <T>(title: string, f: () => Promise<T>) => Promise
1010
* Uses the non-word characters from the position's grammar scope.
1111
*/
1212
export function getWordAtPosition(editor: TextEditor, position: Point): Range {
13-
const nonWordCharacters = escapeRegExp((editor as TextEditorExt).getNonWordCharacters(position))
13+
const nonWordCharacters = escapeRegExp(editor.getNonWordCharacters(position))
1414
const range = _getRegexpRangeAtPosition(
1515
editor.getBuffer(),
1616
position,

typings/atom/index.d.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { Point, Notification, NotificationOptions, TextEditor } from "atom"
22

3-
declare module "atom" {
4-
interface TextEditorExt extends TextEditor {
3+
// NOTE: due to a bug in how TypeScript resolves ambient augments,
4+
// need to be more specific here for TextEditor to keep its "class"
5+
// status and not be demoted to "interface". Should revert this
6+
// once the issue is fixed.
7+
declare module "atom/src/text-editor" {
8+
interface TextEditor {
59
getNonWordCharacters(position: Point): string
610
}
11+
}
712

13+
// NOTE: same here
14+
declare module "atom/src/notification" {
815
/** Non-public Notification api */
9-
interface NotificationExt extends Notification {
16+
interface Notification {
1017
isDismissed?: () => boolean
1118
getOptions?: () => NotificationOptions | null
1219
}

0 commit comments

Comments
 (0)