Skip to content

Commit 41aaff1

Browse files
committed
chore: use atomIde namespace instead of importing individual types
1 parent dc2941b commit 41aaff1

12 files changed

+93
-93
lines changed

lib/adapters/apply-edit-adapter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { TextEdit } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import {
44
LanguageClientConnection,
@@ -23,13 +23,13 @@ export default class ApplyEditAdapter {
2323
*/
2424
public static applyEdits(
2525
buffer: TextBuffer,
26-
edits: TextEdit[],
26+
edits: atomIde.TextEdit[],
2727
): number {
2828
const checkpoint = buffer.createCheckpoint();
2929
try {
3030
// Sort edits in reverse order to prevent edit conflicts.
3131
edits.sort((edit1, edit2) => -edit1.oldRange.compare(edit2.oldRange));
32-
edits.reduce((previous: TextEdit | null, current) => {
32+
edits.reduce((previous: atomIde.TextEdit | null, current) => {
3333
ApplyEditAdapter.validateEdit(buffer, current, previous);
3434
buffer.setTextInRange(current.oldRange, current.newText);
3535
return current;
@@ -97,8 +97,8 @@ export default class ApplyEditAdapter {
9797
/** Private: Do some basic sanity checking on the edit ranges. */
9898
private static validateEdit(
9999
buffer: TextBuffer,
100-
edit: TextEdit,
101-
prevEdit: TextEdit | null,
100+
edit: atomIde.TextEdit,
101+
prevEdit: atomIde.TextEdit | null,
102102
): void {
103103
const path = buffer.getPath() || '';
104104
if (prevEdit && edit.oldRange.end.compare(prevEdit.oldRange.start) > 0) {

lib/adapters/code-action-adapter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CodeAction as AtomCodeAction, Diagnostic } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import LinterPushV2Adapter from './linter-push-v2-adapter';
33
import assert = require('assert');
44
import Convert from '../convert';
@@ -43,8 +43,8 @@ export default class CodeActionAdapter {
4343
linterAdapter: LinterPushV2Adapter | undefined,
4444
editor: TextEditor,
4545
range: Range,
46-
diagnostics: Diagnostic[],
47-
): Promise<AtomCodeAction[]> {
46+
diagnostics: atomIde.Diagnostic[],
47+
): Promise<atomIde.CodeAction[]> {
4848
if (linterAdapter == null) {
4949
return [];
5050
}
@@ -58,7 +58,7 @@ export default class CodeActionAdapter {
5858
private static createCodeAction(
5959
action: Command | CodeAction,
6060
connection: LanguageClientConnection,
61-
): AtomCodeAction {
61+
): atomIde.CodeAction {
6262
return {
6363
async apply() {
6464
if (CodeAction.is(action)) {
@@ -99,7 +99,7 @@ export default class CodeActionAdapter {
9999
linterAdapter: LinterPushV2Adapter,
100100
editor: TextEditor,
101101
range: Range,
102-
diagnostics: Diagnostic[],
102+
diagnostics: atomIde.Diagnostic[],
103103
): CodeActionParams {
104104
return {
105105
textDocument: Convert.editorToTextDocumentIdentifier(editor),

lib/adapters/code-format-adapter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { TextEdit } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import {
44
LanguageClientConnection,
@@ -51,7 +51,7 @@ export default class CodeFormatAdapter {
5151
serverCapabilities: ServerCapabilities,
5252
editor: TextEditor,
5353
range: Range,
54-
): Promise<TextEdit[]> {
54+
): Promise<atomIde.TextEdit[]> {
5555
if (serverCapabilities.documentRangeFormattingProvider) {
5656
return CodeFormatAdapter.formatRange(connection, editor, range);
5757
}
@@ -74,7 +74,7 @@ export default class CodeFormatAdapter {
7474
public static async formatDocument(
7575
connection: LanguageClientConnection,
7676
editor: TextEditor,
77-
): Promise<TextEdit[]> {
77+
): Promise<atomIde.TextEdit[]> {
7878
const edits = await connection.documentFormatting(CodeFormatAdapter.createDocumentFormattingParams(editor));
7979
return Convert.convertLsTextEdits(edits);
8080
}
@@ -107,7 +107,7 @@ export default class CodeFormatAdapter {
107107
connection: LanguageClientConnection,
108108
editor: TextEditor,
109109
range: Range,
110-
): Promise<TextEdit[]> {
110+
): Promise<atomIde.TextEdit[]> {
111111
const edits = await connection.documentRangeFormatting(
112112
CodeFormatAdapter.createDocumentRangeFormattingParams(editor, range),
113113
);
@@ -150,7 +150,7 @@ export default class CodeFormatAdapter {
150150
editor: TextEditor,
151151
point: Point,
152152
character: string,
153-
): Promise<TextEdit[]> {
153+
): Promise<atomIde.TextEdit[]> {
154154
const edits = await connection.documentOnTypeFormatting(
155155
CodeFormatAdapter.createDocumentOnTypeFormattingParams(editor, point, character),
156156
);

lib/adapters/datatip-adapter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MarkedString as AtomMarkedString, Datatip } from 'atom-ide-base'
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import * as Utils from '../utils';
44
import {
@@ -44,7 +44,7 @@ export default class DatatipAdapter {
4444
connection: LanguageClientConnection,
4545
editor: TextEditor,
4646
point: Point,
47-
): Promise<Datatip | null> {
47+
): Promise<atomIde.Datatip | null> {
4848
const documentPositionParams = Convert.editorToTextDocumentPositionParams(editor, point);
4949

5050
const hover = await connection.hover(documentPositionParams);
@@ -72,7 +72,7 @@ export default class DatatipAdapter {
7272
private static convertMarkedString(
7373
editor: TextEditor,
7474
markedString: MarkedString | MarkupContent,
75-
): AtomMarkedString {
75+
): atomIde.MarkedString {
7676
if (typeof markedString === 'string') {
7777
return { type: 'markdown', value: markedString };
7878
}

lib/adapters/definition-adapter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Definition, DefinitionQueryResult } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import * as Utils from '../utils';
44
import {
@@ -49,7 +49,7 @@ export default class DefinitionAdapter {
4949
languageName: string,
5050
editor: TextEditor,
5151
point: Point,
52-
): Promise<DefinitionQueryResult | null> {
52+
): Promise<atomIde.DefinitionQueryResult | null> {
5353
const documentPositionParams = Convert.editorToTextDocumentPositionParams(editor, point);
5454
const definitionLocations = DefinitionAdapter.normalizeLocations(
5555
await connection.gotoDefinition(documentPositionParams),
@@ -93,7 +93,7 @@ export default class DefinitionAdapter {
9393
* @param languageName The name of the language these objects are written in.
9494
* @returns An {Array} of {Definition}s that represented the converted {Location}s.
9595
*/
96-
public static convertLocationsToDefinitions(locations: Location[], languageName: string): Definition[] {
96+
public static convertLocationsToDefinitions(locations: Location[], languageName: string): atomIde.Definition[] {
9797
return locations.map((d) => ({
9898
path: Convert.uriToPath(d.uri),
9999
position: Convert.positionToPoint(d.range.start),

lib/adapters/find-references-adapter.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Reference, FindReferencesReturn } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import {
44
Point,
@@ -44,15 +44,15 @@ export default class FindReferencesAdapter {
4444
editor: TextEditor,
4545
point: Point,
4646
projectRoot: string | null,
47-
): Promise<FindReferencesReturn | null> {
47+
): Promise<atomIde.FindReferencesReturn | null> {
4848
const locations = await connection.findReferences(
4949
FindReferencesAdapter.createReferenceParams(editor, point),
5050
);
5151
if (locations == null) {
5252
return null;
5353
}
5454

55-
const references: Reference[] = locations.map(FindReferencesAdapter.locationToReference);
55+
const references: atomIde.Reference[] = locations.map(FindReferencesAdapter.locationToReference);
5656
return {
5757
type: 'data',
5858
baseUri: projectRoot || '',
@@ -82,7 +82,7 @@ export default class FindReferencesAdapter {
8282
* @param location A {Location} to convert.
8383
* @returns A {Reference} equivalent to the given {Location}.
8484
*/
85-
public static locationToReference(location: Location): Reference {
85+
public static locationToReference(location: Location): atomIde.Reference {
8686
return {
8787
uri: Convert.uriToPath(location.uri),
8888
name: null,
@@ -94,7 +94,7 @@ export default class FindReferencesAdapter {
9494
public static getReferencedSymbolName(
9595
editor: TextEditor,
9696
point: Point,
97-
references: Reference[],
97+
references: atomIde.Reference[],
9898
): string {
9999
if (references.length === 0) {
100100
return '';

lib/adapters/logging-console-adapter.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ConsoleApi } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import {
33
LanguageClientConnection,
44
LogMessageParams,
@@ -7,7 +7,7 @@ import {
77

88
/** Adapts Atom's user notifications to those of the language server protocol. */
99
export default class LoggingConsoleAdapter {
10-
private _consoles: Set<ConsoleApi> = new Set();
10+
private _consoles: Set<atomIde.ConsoleApi> = new Set();
1111

1212
/**
1313
* Create a new {LoggingConsoleAdapter} that will listen for log messages
@@ -25,15 +25,15 @@ export default class LoggingConsoleAdapter {
2525
}
2626

2727
/**
28-
* Public: Attach this {LoggingConsoleAdapter} to a given {ConsoleApi}.
28+
* Public: Attach this {LoggingConsoleAdapter} to a given {atomIde.ConsoleApi}.
2929
*
30-
* @param console A {ConsoleApi} that wants to receive messages.
30+
* @param console A {atomIde.ConsoleApi} that wants to receive messages.
3131
*/
32-
public attach(console: ConsoleApi): void {
32+
public attach(console: atomIde.ConsoleApi): void {
3333
this._consoles.add(console);
3434
}
3535

36-
/** Public: Remove all {ConsoleApi}'s attached to this adapter. */
36+
/** Public: Remove all {atomIde.ConsoleApi}'s attached to this adapter. */
3737
public detachAll(): void {
3838
this._consoles.clear();
3939
}

lib/adapters/outline-view-adapter.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { OutlineTree, Outline, TokenKind } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import * as Utils from '../utils';
44
import { CancellationTokenSource } from 'vscode-jsonrpc';
@@ -43,7 +43,7 @@ export default class OutlineViewAdapter {
4343
* @param editor The Atom {TextEditor} containing the text the Outline should represent.
4444
* @returns A {Promise} containing the {Outline} of this document.
4545
*/
46-
public async getOutline(connection: LanguageClientConnection, editor: TextEditor): Promise<Outline | null> {
46+
public async getOutline(connection: LanguageClientConnection, editor: TextEditor): Promise<atomIde.Outline | null> {
4747
const results = await Utils.doWithCancellationToken(connection, this._cancellationTokens, (cancellationToken) =>
4848
connection.documentSymbol({ textDocument: Convert.editorToTextDocumentIdentifier(editor) }, cancellationToken),
4949
);
@@ -78,7 +78,7 @@ export default class OutlineViewAdapter {
7878
* should be converted to an {Array} of {OutlineTree}.
7979
* @returns An {Array} of {OutlineTree} containing the given symbols that the Outline View can display.
8080
*/
81-
public static createHierarchicalOutlineTrees(symbols: DocumentSymbol[]): OutlineTree[] {
81+
public static createHierarchicalOutlineTrees(symbols: DocumentSymbol[]): atomIde.OutlineTree[] {
8282
// Sort all the incoming symbols
8383
symbols.sort((a, b) => {
8484
if (a.range.start.line !== b.range.start.line) {
@@ -117,7 +117,7 @@ export default class OutlineViewAdapter {
117117
* should be converted to an {OutlineTree}.
118118
* @returns An {OutlineTree} containing the given symbols that the Outline View can display.
119119
*/
120-
public static createOutlineTrees(symbols: SymbolInformation[]): OutlineTree[] {
120+
public static createOutlineTrees(symbols: SymbolInformation[]): atomIde.OutlineTree[] {
121121
symbols.sort(
122122
(a, b) =>
123123
(a.location.range.start.line === b.location.range.start.line
@@ -146,7 +146,7 @@ export default class OutlineViewAdapter {
146146
return map;
147147
}, new Map());
148148

149-
const roots: OutlineTree[] = [];
149+
const roots: atomIde.OutlineTree[] = [];
150150

151151
// Put each item within its parent and extract out the roots
152152
for (const item of allItems) {
@@ -180,14 +180,14 @@ export default class OutlineViewAdapter {
180180
}
181181

182182
private static _getClosestParent(
183-
candidates: OutlineTree[] | null,
184-
child: OutlineTree,
185-
): OutlineTree | null {
183+
candidates: atomIde.OutlineTree[] | null,
184+
child: atomIde.OutlineTree,
185+
): atomIde.OutlineTree | null {
186186
if (candidates == null || candidates.length === 0) {
187187
return null;
188188
}
189189

190-
let parent: OutlineTree | undefined;
190+
let parent: atomIde.OutlineTree | undefined;
191191
for (const candidate of candidates) {
192192
if (
193193
candidate !== child &&
@@ -218,7 +218,7 @@ export default class OutlineViewAdapter {
218218
* @param symbol The {DocumentSymbol} to convert to an {OutlineTree}.
219219
* @returns The {OutlineTree} corresponding to the given {DocumentSymbol}.
220220
*/
221-
public static hierarchicalSymbolToOutline(symbol: DocumentSymbol): OutlineTree {
221+
public static hierarchicalSymbolToOutline(symbol: DocumentSymbol): atomIde.OutlineTree {
222222
const icon = OutlineViewAdapter.symbolKindToEntityKind(symbol.kind);
223223

224224
return {
@@ -243,7 +243,7 @@ export default class OutlineViewAdapter {
243243
* @param symbol The {SymbolInformation} to convert to an {OutlineTree}.
244244
* @returns The {OutlineTree} equivalent to the given {SymbolInformation}.
245245
*/
246-
public static symbolToOutline(symbol: SymbolInformation): OutlineTree {
246+
public static symbolToOutline(symbol: SymbolInformation): atomIde.OutlineTree {
247247
const icon = OutlineViewAdapter.symbolKindToEntityKind(symbol.kind);
248248
return {
249249
tokenizedText: [
@@ -321,7 +321,7 @@ export default class OutlineViewAdapter {
321321
* @param symbol The numeric symbol kind received from the language server.
322322
* @returns A string representing the equivalent syntax token kind.
323323
*/
324-
public static symbolKindToTokenKind(symbol: number): TokenKind {
324+
public static symbolKindToTokenKind(symbol: number): atomIde.TokenKind {
325325
switch (symbol) {
326326
case SymbolKind.Class:
327327
return 'type';

lib/adapters/rename-adapter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { TextEdit as AtomTextEdit, IdeUri } from 'atom-ide-base';
1+
import type * as atomIde from 'atom-ide-base';
22
import Convert from '../convert';
33
import {
44
Point,
@@ -22,7 +22,7 @@ export default class RenameAdapter {
2222
editor: TextEditor,
2323
point: Point,
2424
newName: string,
25-
): Promise<Map<IdeUri, AtomTextEdit[]> | null> {
25+
): Promise<Map<atomIde.IdeUri, atomIde.TextEdit[]> | null> {
2626
const edit = await connection.rename(
2727
RenameAdapter.createRenameParams(editor, point, newName),
2828
);
@@ -49,7 +49,7 @@ export default class RenameAdapter {
4949

5050
public static convertChanges(
5151
changes: { [uri: string]: TextEdit[] },
52-
): Map<IdeUri, AtomTextEdit[]> {
52+
): Map<atomIde.IdeUri, atomIde.TextEdit[]> {
5353
const result = new Map();
5454
Object.keys(changes).forEach((uri) => {
5555
result.set(
@@ -62,7 +62,7 @@ export default class RenameAdapter {
6262

6363
public static convertDocumentChanges(
6464
documentChanges: TextDocumentEdit[],
65-
): Map<IdeUri, AtomTextEdit[]> {
65+
): Map<atomIde.IdeUri, atomIde.TextEdit[]> {
6666
const result = new Map();
6767
documentChanges.forEach((documentEdit) => {
6868
result.set(

lib/adapters/signature-help-adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SignatureHelpRegistry } from "atom-ide-base";
1+
import type * as atomIde from 'atom-ide-base';
22
import assert = require('assert');
33
import Convert from '../convert';
44
import { ActiveServer } from '../server-manager';
@@ -37,7 +37,7 @@ export default class SignatureHelpAdapter {
3737
this._disposables.dispose();
3838
}
3939

40-
public attach(register: SignatureHelpRegistry): void {
40+
public attach(register: atomIde.SignatureHelpRegistry): void {
4141
const { signatureHelpProvider } = this._capabilities;
4242
assert(signatureHelpProvider != null);
4343

0 commit comments

Comments
 (0)