Skip to content

Commit

Permalink
feat: optimize type of suggestion ts defination
Browse files Browse the repository at this point in the history
  • Loading branch information
HaydenOrz committed Jun 6, 2023
1 parent fe1d496 commit c8edbc1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export * from './lib/trinosql/TrinoSqlListener';
export * from './lib/trinosql/TrinoSqlVisitor';

export type * from './parser/common/basic-parser-types';
export type { SyntaxError, ParserError } from './parser/common/parserErrorListener'
export type { SyntaxError, ParserError } from './parser/common/parserErrorListener';
4 changes: 2 additions & 2 deletions src/parser/common/basic-parser-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ export interface WordRange {
/**
* Suggested information analyzed from the input
*/
export interface SyntaxSuggestion<T> {
export interface SyntaxSuggestion<T = WordRange> {
syntaxContextType: SyntaxContextType;
wordRanges: T[];
}

/**
* Suggested information analyzed from the input
*/
export interface Suggestions<T> {
export interface Suggestions<T = WordRange> {
/**
* Suggestions about syntax
*/
Expand Down
2 changes: 1 addition & 1 deletion src/parser/common/basicParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default abstract class BasicParser<
* @param caretPosition caret position, such as cursor position
* @returns suggestion
*/
getSuggestionAtCaretPosition(input: string, caretPosition: CaretPosition): Suggestions<WordRange> | null {
getSuggestionAtCaretPosition(input: string, caretPosition: CaretPosition): Suggestions | null {
this.parse(input);
const allTokens = this.getAllTokens(input);
const caretTokenIndex = findCaretTokenIndex(caretPosition, allTokens);
Expand Down

0 comments on commit c8edbc1

Please sign in to comment.