mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
fix(language-server): Go-to definition for path in use
expression [LNG-187] (#733)
add tokens for `use` and `use-from` expressions to language server
This commit is contained in:
parent
da0821d9d5
commit
21cb3937ac
@ -1,7 +1,7 @@
|
||||
package aqua.lsp
|
||||
|
||||
import aqua.parser.Ast
|
||||
import aqua.parser.head.{ImportExpr, ImportFromExpr}
|
||||
import aqua.parser.head.{ImportExpr, ImportFromExpr, UseExpr, UseFromExpr}
|
||||
import aqua.parser.lexer.{LiteralToken, Token}
|
||||
import aqua.semantics.rules.ReportError
|
||||
import aqua.semantics.rules.locations.LocationsState
|
||||
@ -24,6 +24,8 @@ class LspSemantics[S[_]] extends Semantics[S, LspContext[S]] {
|
||||
header match {
|
||||
case ImportExpr(fn) => l :+ fn
|
||||
case ImportFromExpr(_, fn) => l :+ fn
|
||||
case UseExpr(fn, _) => l :+ fn
|
||||
case UseFromExpr(_, fn, _) => l :+ fn
|
||||
case _ => l
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import aqua.parser.lift.Span
|
||||
import aqua.parser.lift.Span.{P0ToSpan, PToSpan}
|
||||
|
||||
case class UseExpr[F[_]](
|
||||
filename: LiteralToken[F],
|
||||
asModule: Option[Ability[F]]
|
||||
filename: LiteralToken[F],
|
||||
asModule: Option[Ability[F]]
|
||||
) extends FilenameExpr[F] {
|
||||
|
||||
override def mapK[K[_]: Comonad](fk: F ~> K): UseExpr[K] =
|
||||
@ -24,7 +24,8 @@ case class UseExpr[F[_]](
|
||||
object UseExpr extends HeaderExpr.Leaf {
|
||||
|
||||
override val p: Parser[HeaderExpr[Span.S]] =
|
||||
(`use` *> ` ` *> ValueToken.string ~ (` as ` *> Ability.ab).?).map { case (filename, asModule) =>
|
||||
UseExpr(filename, asModule)
|
||||
(`use` *> ` ` *> ValueToken.string ~ (` as ` *> Ability.ab).?).map {
|
||||
case (filename, asModule) =>
|
||||
UseExpr(filename, asModule)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user