summaryrefslogtreecommitdiff
path: root/cli/lsp/documents.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-05-15 14:41:37 -0400
committerGitHub <noreply@github.com>2022-05-15 14:41:37 -0400
commiteb5ffab1cbc010424aa1764005f71dcd67525dc1 (patch)
tree31f66727bb590a99f4e67a11e4874f72f9d3567e /cli/lsp/documents.rs
parent8744ee883e093ecc09add4054177f8afa793ec77 (diff)
fix(lsp): correct positions in some scenarios (#14359)
Diffstat (limited to 'cli/lsp/documents.rs')
-rw-r--r--cli/lsp/documents.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs
index 0a383e781..4fb8c428e 100644
--- a/cli/lsp/documents.rs
+++ b/cli/lsp/documents.rs
@@ -200,6 +200,13 @@ impl AssetOrDocument {
}
}
+ pub fn media_type(&self) -> MediaType {
+ match self {
+ AssetOrDocument::Asset(_) => MediaType::TypeScript, // assets are always TypeScript
+ AssetOrDocument::Document(d) => d.media_type(),
+ }
+ }
+
pub fn get_maybe_dependency(
&self,
position: &lsp::Position,