Lint the language service package
This commit is contained in:
@@ -29,7 +29,7 @@ export function mapToExpressionPos(token: TemplateToken, position: Position): Ex
|
||||
if (token.originalExpressions?.length) {
|
||||
for (const originalExp of token.originalExpressions) {
|
||||
// Find the original expression that contains the position
|
||||
if (posWithinRange(pos, originalExp.expressionRange!)) {
|
||||
if (originalExp.expressionRange && posWithinRange(pos, originalExp.expressionRange)) {
|
||||
const exprRange = mapRange(originalExp.expressionRange);
|
||||
|
||||
return {
|
||||
@@ -47,7 +47,7 @@ export function mapToExpressionPos(token: TemplateToken, position: Position): Ex
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const exprRange = mapRange(token.expressionRange!);
|
||||
const exprRange = mapRange(token.expressionRange);
|
||||
return {
|
||||
expression: token.expression,
|
||||
// Adjust the position to point into the expression
|
||||
|
||||
@@ -11,28 +11,30 @@ import {getPositionFromCursor} from "../test-utils/cursor-position";
|
||||
import {HoverVisitor} from "./visitor";
|
||||
|
||||
const contextProviderConfig: ContextProviderConfig = {
|
||||
getContext: async (context: string) => {
|
||||
getContext: (context: string) => {
|
||||
switch (context) {
|
||||
case "github":
|
||||
return new DescriptionDictionary(
|
||||
{
|
||||
key: "event",
|
||||
value: new data.StringData("push"),
|
||||
description: "The event that triggered the workflow"
|
||||
},
|
||||
{
|
||||
key: "test",
|
||||
value: new DescriptionDictionary({
|
||||
key: "name",
|
||||
return Promise.resolve(
|
||||
new DescriptionDictionary(
|
||||
{
|
||||
key: "event",
|
||||
value: new data.StringData("push"),
|
||||
description: "Name for the test"
|
||||
}),
|
||||
description: "Test dictionary"
|
||||
}
|
||||
description: "The event that triggered the workflow"
|
||||
},
|
||||
{
|
||||
key: "test",
|
||||
value: new DescriptionDictionary({
|
||||
key: "name",
|
||||
value: new data.StringData("push"),
|
||||
description: "Name for the test"
|
||||
}),
|
||||
description: "Test dictionary"
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
Logical,
|
||||
Unary
|
||||
} from "@github/actions-expressions/ast";
|
||||
import {FunctionDefinition, FunctionInfo} from "@github/actions-expressions/funcs/info";
|
||||
import {FunctionDefinition} from "@github/actions-expressions/funcs/info";
|
||||
import {Pos, Range} from "@github/actions-expressions/lexer";
|
||||
import {posWithinRange} from "./pos-range";
|
||||
|
||||
@@ -35,7 +35,6 @@ export class HoverVisitor implements ExprVisitor<HoverResult> {
|
||||
constructor(
|
||||
private pos: Pos,
|
||||
private context: DescriptionDictionary,
|
||||
private extensionFunctions: FunctionInfo[],
|
||||
private functions: Map<string, FunctionDefinition>
|
||||
) {}
|
||||
|
||||
@@ -43,7 +42,7 @@ export class HoverVisitor implements ExprVisitor<HoverResult> {
|
||||
return n.accept(this);
|
||||
}
|
||||
|
||||
visitLiteral(literal: Literal): HoverResult {
|
||||
visitLiteral(): HoverResult {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user