mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
refactor: remove dead code from lsp (#13743)
This commit is contained in:
parent
7122187bc7
commit
973fe6dd3a
12 changed files with 54 additions and 134 deletions
|
@ -268,10 +268,6 @@ impl Assets {
|
|||
AssetsSnapshot(self.assets.clone())
|
||||
}
|
||||
|
||||
pub fn contains_key(&self, k: &ModuleSpecifier) -> bool {
|
||||
self.assets.lock().contains_key(k)
|
||||
}
|
||||
|
||||
pub fn get_cached(
|
||||
&self,
|
||||
k: &ModuleSpecifier,
|
||||
|
@ -669,11 +665,15 @@ pub struct JsDocTagInfo {
|
|||
text: Option<Vec<SymbolDisplayPart>>,
|
||||
}
|
||||
|
||||
// Note: the tsc protocol contains fields that are part of the protocol but
|
||||
// not currently used. They are commented out in the structures so it is clear
|
||||
// that they exist.
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct QuickInfo {
|
||||
kind: ScriptElementKind,
|
||||
kind_modifiers: String,
|
||||
// kind: ScriptElementKind,
|
||||
// kind_modifiers: String,
|
||||
text_span: TextSpan,
|
||||
display_parts: Option<Vec<SymbolDisplayPart>>,
|
||||
documentation: Option<Vec<SymbolDisplayPart>>,
|
||||
|
@ -815,7 +815,7 @@ pub struct DocumentSpan {
|
|||
text_span: TextSpan,
|
||||
pub file_name: String,
|
||||
original_text_span: Option<TextSpan>,
|
||||
original_file_name: Option<String>,
|
||||
// original_file_name: Option<String>,
|
||||
context_span: Option<TextSpan>,
|
||||
original_context_span: Option<TextSpan>,
|
||||
}
|
||||
|
@ -915,12 +915,12 @@ pub struct NavigateToItem {
|
|||
name: String,
|
||||
kind: ScriptElementKind,
|
||||
kind_modifiers: String,
|
||||
match_kind: MatchKind,
|
||||
is_case_sensitive: bool,
|
||||
// match_kind: MatchKind,
|
||||
// is_case_sensitive: bool,
|
||||
file_name: String,
|
||||
text_span: TextSpan,
|
||||
container_name: Option<String>,
|
||||
container_kind: ScriptElementKind,
|
||||
// container_kind: ScriptElementKind,
|
||||
}
|
||||
|
||||
impl NavigateToItem {
|
||||
|
@ -1123,8 +1123,8 @@ pub struct ImplementationLocation {
|
|||
#[serde(flatten)]
|
||||
pub document_span: DocumentSpan,
|
||||
// ImplementationLocation props
|
||||
kind: ScriptElementKind,
|
||||
display_parts: Vec<SymbolDisplayPart>,
|
||||
// kind: ScriptElementKind,
|
||||
// display_parts: Vec<SymbolDisplayPart>,
|
||||
}
|
||||
|
||||
impl ImplementationLocation {
|
||||
|
@ -1163,8 +1163,8 @@ pub struct RenameLocation {
|
|||
#[serde(flatten)]
|
||||
document_span: DocumentSpan,
|
||||
// RenameLocation props
|
||||
prefix_text: Option<String>,
|
||||
suffix_text: Option<String>,
|
||||
// prefix_text: Option<String>,
|
||||
// suffix_text: Option<String>,
|
||||
}
|
||||
|
||||
pub struct RenameLocations {
|
||||
|
@ -1236,21 +1236,20 @@ pub enum HighlightSpanKind {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct HighlightSpan {
|
||||
file_name: Option<String>,
|
||||
is_in_string: Option<bool>,
|
||||
// file_name: Option<String>,
|
||||
// is_in_string: Option<bool>,
|
||||
text_span: TextSpan,
|
||||
context_span: Option<TextSpan>,
|
||||
// context_span: Option<TextSpan>,
|
||||
kind: HighlightSpanKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DefinitionInfo {
|
||||
kind: ScriptElementKind,
|
||||
name: String,
|
||||
container_kind: Option<ScriptElementKind>,
|
||||
container_name: Option<String>,
|
||||
|
||||
// kind: ScriptElementKind,
|
||||
// name: String,
|
||||
// container_kind: Option<ScriptElementKind>,
|
||||
// container_name: Option<String>,
|
||||
#[serde(flatten)]
|
||||
pub document_span: DocumentSpan,
|
||||
}
|
||||
|
@ -1259,7 +1258,7 @@ pub struct DefinitionInfo {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DefinitionInfoAndBoundSpan {
|
||||
pub definitions: Option<Vec<DefinitionInfo>>,
|
||||
text_span: TextSpan,
|
||||
// text_span: TextSpan,
|
||||
}
|
||||
|
||||
impl DefinitionInfoAndBoundSpan {
|
||||
|
@ -1289,7 +1288,7 @@ impl DefinitionInfoAndBoundSpan {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DocumentHighlights {
|
||||
file_name: String,
|
||||
// file_name: String,
|
||||
highlight_spans: Vec<HighlightSpan>,
|
||||
}
|
||||
|
||||
|
@ -1538,9 +1537,9 @@ impl RefactorActionInfo {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ApplicableRefactorInfo {
|
||||
name: String,
|
||||
description: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
inlineable: Option<bool>,
|
||||
// description: String,
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// inlineable: Option<bool>,
|
||||
actions: Vec<RefactorActionInfo>,
|
||||
}
|
||||
|
||||
|
@ -1620,10 +1619,10 @@ impl RefactorEditInfo {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CodeAction {
|
||||
description: String,
|
||||
changes: Vec<FileTextChanges>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
commands: Option<Vec<Value>>,
|
||||
// description: String,
|
||||
// changes: Vec<FileTextChanges>,
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// commands: Option<Vec<Value>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
|
||||
|
@ -1657,9 +1656,9 @@ pub struct CombinedCodeActions {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ReferenceEntry {
|
||||
is_write_access: bool,
|
||||
// is_write_access: bool,
|
||||
pub is_definition: bool,
|
||||
is_in_string: Option<bool>,
|
||||
// is_in_string: Option<bool>,
|
||||
#[serde(flatten)]
|
||||
pub document_span: DocumentSpan,
|
||||
}
|
||||
|
@ -1862,14 +1861,14 @@ impl CallHierarchyOutgoingCall {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CompletionEntryDetails {
|
||||
name: String,
|
||||
kind: ScriptElementKind,
|
||||
kind_modifiers: String,
|
||||
// name: String,
|
||||
// kind: ScriptElementKind,
|
||||
// kind_modifiers: String,
|
||||
display_parts: Vec<SymbolDisplayPart>,
|
||||
documentation: Option<Vec<SymbolDisplayPart>>,
|
||||
tags: Option<Vec<JsDocTagInfo>>,
|
||||
code_actions: Option<Vec<CodeAction>>,
|
||||
source: Option<Vec<SymbolDisplayPart>>,
|
||||
// code_actions: Option<Vec<CodeAction>>,
|
||||
// source: Option<Vec<SymbolDisplayPart>>,
|
||||
}
|
||||
|
||||
impl CompletionEntryDetails {
|
||||
|
@ -2202,9 +2201,9 @@ pub enum OutliningSpanKind {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct OutliningSpan {
|
||||
text_span: TextSpan,
|
||||
hint_span: TextSpan,
|
||||
banner_text: String,
|
||||
auto_collapse: bool,
|
||||
// hint_span: TextSpan,
|
||||
// banner_text: String,
|
||||
// auto_collapse: bool,
|
||||
kind: OutliningSpanKind,
|
||||
}
|
||||
|
||||
|
@ -2275,10 +2274,10 @@ impl OutliningSpan {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SignatureHelpItems {
|
||||
items: Vec<SignatureHelpItem>,
|
||||
applicable_span: TextSpan,
|
||||
// applicable_span: TextSpan,
|
||||
selected_item_index: u32,
|
||||
argument_index: u32,
|
||||
argument_count: u32,
|
||||
// argument_count: u32,
|
||||
}
|
||||
|
||||
impl SignatureHelpItems {
|
||||
|
@ -2301,13 +2300,13 @@ impl SignatureHelpItems {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SignatureHelpItem {
|
||||
is_variadic: bool,
|
||||
// is_variadic: bool,
|
||||
prefix_display_parts: Vec<SymbolDisplayPart>,
|
||||
suffix_display_parts: Vec<SymbolDisplayPart>,
|
||||
separator_display_parts: Vec<SymbolDisplayPart>,
|
||||
// separator_display_parts: Vec<SymbolDisplayPart>,
|
||||
parameters: Vec<SignatureHelpParameter>,
|
||||
documentation: Vec<SymbolDisplayPart>,
|
||||
tags: Vec<JsDocTagInfo>,
|
||||
// tags: Vec<JsDocTagInfo>,
|
||||
}
|
||||
|
||||
impl SignatureHelpItem {
|
||||
|
@ -2352,10 +2351,10 @@ impl SignatureHelpItem {
|
|||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SignatureHelpParameter {
|
||||
name: String,
|
||||
// name: String,
|
||||
documentation: Vec<SymbolDisplayPart>,
|
||||
display_parts: Vec<SymbolDisplayPart>,
|
||||
is_optional: bool,
|
||||
// is_optional: bool,
|
||||
}
|
||||
|
||||
impl SignatureHelpParameter {
|
||||
|
@ -2404,7 +2403,7 @@ impl SelectionRange {
|
|||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
struct Response {
|
||||
id: usize,
|
||||
// id: usize,
|
||||
data: Value,
|
||||
}
|
||||
|
||||
|
@ -2544,7 +2543,7 @@ fn op_exists(state: &mut State, args: SpecifierArgs) -> Result<bool, AnyError> {
|
|||
// sometimes tsc tries to query invalid specifiers, especially when
|
||||
// something else isn't quite right, so instead of bubbling up the error
|
||||
// back to tsc, we simply swallow it and say the file doesn't exist
|
||||
Err(err) => return Ok(false),
|
||||
Err(_) => return Ok(false),
|
||||
};
|
||||
let result = state.state_snapshot.documents.exists(&specifier);
|
||||
Ok(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue