diff options
| author | Satya Rohith <me@satyarohith.com> | 2021-06-21 12:13:35 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-21 16:43:35 +1000 |
| commit | 952caa79b32e6c249977281ed494d4b1f98ed451 (patch) | |
| tree | 3f072fc64b571eca1b203fb07df3689ad4fc3a95 /cli/lsp/documents.rs | |
| parent | bbc2745350687f209c6af75958cc12bb43e64042 (diff) | |
feat(lsp): quick fix actions to ignore lint errors (#10627)
Closes #10122
Diffstat (limited to 'cli/lsp/documents.rs')
| -rw-r--r-- | cli/lsp/documents.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 5e08245cb..45903fa21 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -139,12 +139,22 @@ impl DocumentData { Ok(None) } } + + pub fn content_line(&self, line: usize) -> Result<Option<String>, AnyError> { + let content = self.content().ok().flatten(); + if let Some(content) = content { + let lines = content.lines().into_iter().collect::<Vec<&str>>(); + Ok(Some(lines[line].to_string())) + } else { + Ok(None) + } + } } #[derive(Debug, Clone, Default)] pub struct DocumentCache { dependents_graph: HashMap<ModuleSpecifier, HashSet<ModuleSpecifier>>, - docs: HashMap<ModuleSpecifier, DocumentData>, + pub docs: HashMap<ModuleSpecifier, DocumentData>, } impl DocumentCache { |
