Skip to content

Commit a46f99c

Browse files
committed
fix: autocomplete-extended types
- Using relative path ensures that the types are included in the build - This removes the interanl types from atom-ide module
1 parent c69fd77 commit a46f99c

File tree

4 files changed

+27
-34
lines changed

4 files changed

+27
-34
lines changed

lib/adapters/autocomplete-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
TextEditor,
2121
} from 'atom';
2222
import * as ac from 'atom/autocomplete-plus';
23-
import { Suggestion, TextSuggestion, SnippetSuggestion } from 'atom-ide';
23+
import { Suggestion, TextSuggestion, SnippetSuggestion } from '../types/autocomplete-extended';
2424

2525
/**
2626
* Holds a list of suggestions generated from the CompletionItem[]

lib/types/autocomplete-extended.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Autocomplete extention (the properties added by atom-languageclient)
2+
// See this PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/51284
3+
4+
import * as ac from 'atom/autocomplete-plus';
5+
6+
/** Adds LSP specific properties to the Atom SuggestionBase type */
7+
interface SuggestionBase extends ac.SuggestionBase {
8+
/**
9+
* A string that is used when filtering and sorting a set of
10+
* completion items with a prefix present. When `falsy` the
11+
* [displayText](#ac.SuggestionBase.displayText) is used. When
12+
* no prefix, the `sortText` property is used.
13+
*/
14+
filterText?: string;
15+
16+
/**
17+
* String representing the replacement prefix from the suggestion's
18+
* custom start point to the original buffer position the suggestion
19+
* was gathered from.
20+
*/
21+
customReplacmentPrefix?: string;
22+
}
23+
export type TextSuggestion = SuggestionBase & ac.TextSuggestion;
24+
export type SnippetSuggestion = SuggestionBase & ac.SnippetSuggestion;
25+
export type Suggestion = TextSuggestion | SnippetSuggestion;

test/adapters/autocomplete-adapter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import * as ac from 'atom/autocomplete-plus';
1010
import { expect } from 'chai';
1111
import { createSpyConnection, createFakeEditor } from '../helpers.js';
12-
import { TextSuggestion, SnippetSuggestion } from 'atom-ide';
12+
import { TextSuggestion, SnippetSuggestion } from '../../lib/types/autocomplete-extended';
1313
import { CompletionItem, MarkupContent, InsertTextFormat, TextEdit, Command } from '../../lib/languageclient';
1414

1515
function createRequest({

typings/atom-ide/index.d.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
declare module 'atom-ide' {
2-
32
// atom-ide-base types for backward compatibility
43
export * from "atom-ide-base/types-packages/main"
5-
6-
// NotificationButton for backward compatibility (moved to "../../lib/adapters/notifications-adapter")
7-
export interface NotificationButton {
8-
text: string
9-
}
10-
11-
// Autocomplete extention (the properties added by atom-languageclient)
12-
// See this PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/51284
13-
14-
import * as ac from 'atom/autocomplete-plus';
15-
16-
/** Adds LSP specific properties to the Atom SuggestionBase type */
17-
interface SuggestionBase extends ac.SuggestionBase {
18-
/**
19-
* A string that is used when filtering and sorting a set of
20-
* completion items with a prefix present. When `falsy` the
21-
* [displayText](#ac.SuggestionBase.displayText) is used. When
22-
* no prefix, the `sortText` property is used.
23-
*/
24-
filterText?: string;
25-
26-
/**
27-
* String representing the replacement prefix from the suggestion's
28-
* custom start point to the original buffer position the suggestion
29-
* was gathered from.
30-
*/
31-
customReplacmentPrefix?: string;
32-
}
33-
export type TextSuggestion = SuggestionBase & ac.TextSuggestion;
34-
export type SnippetSuggestion = SuggestionBase & ac.SnippetSuggestion;
35-
export type Suggestion = TextSuggestion | SnippetSuggestion;
364
}

0 commit comments

Comments
 (0)