Skip to content

Commit

Permalink
fixed typo and removed a bit of redundancy
Browse files Browse the repository at this point in the history
workstream:
  • Loading branch information
nkappler committed Feb 19, 2019
1 parent af48f5c commit 6f7f71a
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions types/tern/lib/tern/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,20 @@ export interface BaseQuery {
docFormat?: "full";
}

export interface BaseQueryWithFile extends BaseQuery {
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
}

export interface Position {
ch: number;
line: number;
}

/** Asks the server for a set of completions at the given point. */
export interface CompletionsQuery extends BaseQuery {
export interface CompletionsQuery extends BaseQueryWithFile {
/** Asks the server for a set of completions at the given point. */
type: "completions";
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
/** Specify the location to complete at. */
end: number | Position;
/** Whether to include the types of the completions in the result data. Default `false` */
Expand Down Expand Up @@ -233,11 +236,9 @@ export interface CompletionsQueryResult {
}

/** Query the type of something. */
export interface TypeQuery extends BaseQuery {
export interface TypeQuery extends BaseQueryWithFile {
/** Query the type of something. */
type: "type";
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
/** Specify the location of the expression. */
end: number | Position;
/** Specify the location of the expression. */
Expand Down Expand Up @@ -282,7 +283,7 @@ export interface TypeQueryResult {
* type is not an object or function (other types don’t store their definition site),
* it will fail to return useful information.
*/
export interface DefinitionQuery extends BaseQuery {
export interface DefinitionQuery extends BaseQueryWithFile {
/**
* Asks for the definition of something. This will try, for a variable or property,
* to return the point at which it was defined. If that fails, or the chosen
Expand All @@ -292,8 +293,6 @@ export interface DefinitionQuery extends BaseQuery {
* it will fail to return useful information.
*/
type: "definition";
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
/** Specify the location of the expression. */
end: number | Position;
/** Specify the location of the expression. */
Expand All @@ -320,11 +319,9 @@ export interface DefinitionQueryResult {
}

/** Get the documentation string and URL for a given expression, if any. */
export interface DocumentationQuery extends BaseQuery {
export interface DocumentationQuery extends BaseQueryWithFile {
/** Get the documentation string and URL for a given expression, if any. */
type: "documentation";
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
/** Specify the location of the expression. */
end: number | Position;
/** Specify the location of the expression. */
Expand All @@ -341,11 +338,9 @@ export interface DocumentationQueryResult {
}

/** Used to find all references to a given variable or property. */
export interface RefsQuery extends BaseQuery {
export interface RefsQuery extends BaseQueryWithFile {
/** Used to find all references to a given variable or property. */
type: "refs";
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
/** Specify the location of the expression. */
end: number | Position;
/** Specify the location of the expression. */
Expand All @@ -365,11 +360,9 @@ export interface RefsQueryResult {
}

/** Rename a variable in a scope-aware way. */
export interface RenameQuery extends BaseQuery {
export interface RenameQuery extends BaseQueryWithFile {
/** Rename a variable in a scope-aware way. */
type: "rename";
/** may hold either a filename, or a string in the form "#N", where N should be an integer referring to one of the files included in the request */
file: string;
/** Specify the location of the variable. */
end: number | Position;
/** Specify the location of the variable. */
Expand Down Expand Up @@ -467,7 +460,7 @@ export function registerPlugin(name: string, init: (server: Server, options?: Co

export interface Desc<T extends Query["type"]> {
run(Server: Server, query: QueryRegistry[T]["query"], file?: File): QueryRegistry[T]["result"];
takesfile?: boolean;
takesFile?: boolean;
}

/**
Expand Down

0 comments on commit 6f7f71a

Please sign in to comment.