Fix a bunch of warnings
This commit is contained in:
		
							parent
							
								
									1d0fd9dd0a
								
							
						
					
					
						commit
						77107ef95e
					
				| @ -3,8 +3,6 @@ | |||||||
| 
 | 
 | ||||||
| use std::{cell::RefCell, rc::Rc}; | use std::{cell::RefCell, rc::Rc}; | ||||||
| 
 | 
 | ||||||
| use llvm_sys::core::LLVMBuildIsNull; |  | ||||||
| 
 |  | ||||||
| use crate::{ | use crate::{ | ||||||
|     Block, BlockData, CompileResult, ConstValueKind, CustomTypeKind, ErrorKind, FunctionData, Instr, InstructionData, |     Block, BlockData, CompileResult, ConstValueKind, CustomTypeKind, ErrorKind, FunctionData, Instr, InstructionData, | ||||||
|     ModuleData, NamedStruct, TerminatorKind, Type, TypeCategory, TypeData, |     ModuleData, NamedStruct, TerminatorKind, Type, TypeCategory, TypeData, | ||||||
|  | |||||||
| @ -2,16 +2,15 @@ use std::{collections::HashMap, hash::Hash, path::PathBuf}; | |||||||
| 
 | 
 | ||||||
| use reid::{ | use reid::{ | ||||||
|     ast::{ |     ast::{ | ||||||
|         ReturnType, |  | ||||||
|         lexer::{FullToken, Token}, |         lexer::{FullToken, Token}, | ||||||
|         token_stream::TokenRange, |         token_stream::TokenRange, | ||||||
|     }, |     }, | ||||||
|     codegen::intrinsics::{self, get_intrinsic_assoc_functions}, |     codegen::intrinsics::get_intrinsic_assoc_functions, | ||||||
|     compile_module, |     compile_module, | ||||||
|     error_raporting::{ErrorModules, ReidError}, |     error_raporting::{ErrorModules, ReidError}, | ||||||
|     mir::{ |     mir::{ | ||||||
|         self, Context, CustomTypeKey, FunctionCall, FunctionDefinitionKind, FunctionParam, IfExpression, Metadata, |         self, Context, CustomTypeKey, FunctionCall, FunctionParam, IfExpression, Metadata, SourceModuleId, StructType, | ||||||
|         SourceModuleId, StructType, TypeKind, WhileStatement, typecheck::typerefs::TypeRefs, |         TypeKind, WhileStatement, typecheck::typerefs::TypeRefs, | ||||||
|     }, |     }, | ||||||
|     perform_all_passes, |     perform_all_passes, | ||||||
| }; | }; | ||||||
| @ -200,26 +199,6 @@ impl AnalysisState { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub fn set_documentation(&mut self, token_idx: usize, documentation: Option<String>) { |  | ||||||
|         if let Some(documentation) = documentation { |  | ||||||
|             if let Some(token) = self.map.get_mut(&token_idx) { |  | ||||||
|                 token.hover.documentation = Some(documentation); |  | ||||||
|             } else { |  | ||||||
|                 self.map.insert( |  | ||||||
|                     token_idx, |  | ||||||
|                     SemanticToken { |  | ||||||
|                         hover: Hover { |  | ||||||
|                             documentation: Some(documentation), |  | ||||||
|                             kind: None, |  | ||||||
|                         }, |  | ||||||
|                         autocomplete: Vec::new(), |  | ||||||
|                         symbol: Default::default(), |  | ||||||
|                     }, |  | ||||||
|                 ); |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     pub fn set_symbol(&mut self, idx: usize, symbol: SymbolId) { |     pub fn set_symbol(&mut self, idx: usize, symbol: SymbolId) { | ||||||
|         self.symbol_to_token.insert(symbol, idx); |         self.symbol_to_token.insert(symbol, idx); | ||||||
|         if let Some(token) = self.map.get_mut(&idx) { |         if let Some(token) = self.map.get_mut(&idx) { | ||||||
| @ -717,7 +696,7 @@ pub fn analyze_context( | |||||||
| 
 | 
 | ||||||
|         let mut inner_scope = scope.inner(); |         let mut inner_scope = scope.inner(); | ||||||
| 
 | 
 | ||||||
|         analyze_function_parameters(context, module, function, &mut inner_scope); |         analyze_function_parameters(module, function, &mut inner_scope); | ||||||
| 
 | 
 | ||||||
|         match &function.kind { |         match &function.kind { | ||||||
|             mir::FunctionDefinitionKind::Local(block, _) => analyze_block(context, module, block, &mut inner_scope), |             mir::FunctionDefinitionKind::Local(block, _) => analyze_block(context, module, block, &mut inner_scope), | ||||||
| @ -779,7 +758,7 @@ pub fn analyze_context( | |||||||
| 
 | 
 | ||||||
|         let mut inner_scope = scope.inner(); |         let mut inner_scope = scope.inner(); | ||||||
| 
 | 
 | ||||||
|         analyze_function_parameters(context, module, function, &mut inner_scope); |         analyze_function_parameters(module, function, &mut inner_scope); | ||||||
| 
 | 
 | ||||||
|         match &function.kind { |         match &function.kind { | ||||||
|             mir::FunctionDefinitionKind::Local(block, _) => analyze_block(context, module, block, &mut inner_scope), |             mir::FunctionDefinitionKind::Local(block, _) => analyze_block(context, module, block, &mut inner_scope), | ||||||
| @ -872,7 +851,6 @@ pub fn analyze_context( | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| pub fn analyze_function_parameters( | pub fn analyze_function_parameters( | ||||||
|     context: &mir::Context, |  | ||||||
|     module: &mir::Module, |     module: &mir::Module, | ||||||
|     function: &mir::FunctionDefinition, |     function: &mir::FunctionDefinition, | ||||||
|     scope: &mut AnalysisScope, |     scope: &mut AnalysisScope, | ||||||
|  | |||||||
| @ -9,15 +9,15 @@ use reid::parse_module; | |||||||
| use serde::{Deserialize, Serialize}; | use serde::{Deserialize, Serialize}; | ||||||
| use tokio::sync::Mutex; | use tokio::sync::Mutex; | ||||||
| use tower_lsp::lsp_types::{ | use tower_lsp::lsp_types::{ | ||||||
|     self, CompletionItem, CompletionItemKind, CompletionOptions, CompletionParams, CompletionResponse, Diagnostic, |     self, CompletionItem, CompletionOptions, CompletionParams, CompletionResponse, Diagnostic, DiagnosticSeverity, | ||||||
|     DiagnosticSeverity, DidChangeTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams, |     DidChangeTextDocumentParams, DidOpenTextDocumentParams, DidSaveTextDocumentParams, DocumentFilter, | ||||||
|     DocumentFilter, GotoDefinitionParams, GotoDefinitionResponse, Hover, HoverContents, HoverParams, |     GotoDefinitionParams, GotoDefinitionResponse, Hover, HoverContents, HoverParams, HoverProviderCapability, | ||||||
|     HoverProviderCapability, InitializeParams, InitializeResult, InitializedParams, Location, MarkedString, |     InitializeParams, InitializeResult, InitializedParams, Location, MarkedString, MarkupContent, MarkupKind, | ||||||
|     MarkupContent, MarkupKind, MessageType, OneOf, Range, ReferenceParams, RenameParams, SemanticToken, |     MessageType, OneOf, Range, ReferenceParams, RenameParams, SemanticToken, SemanticTokensLegend, | ||||||
|     SemanticTokensLegend, SemanticTokensOptions, SemanticTokensParams, SemanticTokensResult, |     SemanticTokensOptions, SemanticTokensParams, SemanticTokensResult, SemanticTokensServerCapabilities, | ||||||
|     SemanticTokensServerCapabilities, ServerCapabilities, TextDocumentItem, TextDocumentRegistrationOptions, |     ServerCapabilities, TextDocumentItem, TextDocumentRegistrationOptions, TextDocumentSyncCapability, | ||||||
|     TextDocumentSyncCapability, TextDocumentSyncKind, TextDocumentSyncOptions, TextDocumentSyncSaveOptions, TextEdit, |     TextDocumentSyncKind, TextDocumentSyncOptions, TextDocumentSyncSaveOptions, TextEdit, Url, WorkspaceEdit, | ||||||
|     Url, WorkspaceEdit, WorkspaceFoldersServerCapabilities, WorkspaceServerCapabilities, |     WorkspaceFoldersServerCapabilities, WorkspaceServerCapabilities, | ||||||
| }; | }; | ||||||
| use tower_lsp::{Client, LanguageServer, LspService, Server, jsonrpc}; | use tower_lsp::{Client, LanguageServer, LspService, Server, jsonrpc}; | ||||||
| 
 | 
 | ||||||
| @ -65,7 +65,7 @@ impl LanguageServer for Backend { | |||||||
|                 completion_item: Some(lsp_types::CompletionOptionsCompletionItem { |                 completion_item: Some(lsp_types::CompletionOptionsCompletionItem { | ||||||
|                     label_details_support: Some(true), |                     label_details_support: Some(true), | ||||||
|                 }), |                 }), | ||||||
|                 resolve_provider: Some(true), |                 resolve_provider: Some(false), | ||||||
|                 work_done_progress_options: lsp_types::WorkDoneProgressOptions { |                 work_done_progress_options: lsp_types::WorkDoneProgressOptions { | ||||||
|                     work_done_progress: Some(true), |                     work_done_progress: Some(true), | ||||||
|                 }, |                 }, | ||||||
| @ -172,20 +172,6 @@ impl LanguageServer for Backend { | |||||||
|         Ok(Some(CompletionResponse::Array(list))) |         Ok(Some(CompletionResponse::Array(list))) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async fn completion_resolve(&self, params: CompletionItem) -> jsonrpc::Result<CompletionItem> { |  | ||||||
|         let data: Option<CompletionData> = if let Some(data) = ¶ms.data { |  | ||||||
|             serde_json::from_value(data.clone()).ok() |  | ||||||
|         } else { |  | ||||||
|             None |  | ||||||
|         }; |  | ||||||
|         if let Some(data) = data { |  | ||||||
|             let analysis = self.analysis.get(&data.path).unwrap(); |  | ||||||
|             let token = analysis.tokens.get(data.token_idx).unwrap(); |  | ||||||
|             if let Some(token_analysis) = analysis.state.map.get(&data.token_idx) {} |  | ||||||
|         } |  | ||||||
|         Ok(params) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     async fn hover(&self, params: HoverParams) -> jsonrpc::Result<Option<Hover>> { |     async fn hover(&self, params: HoverParams) -> jsonrpc::Result<Option<Hover>> { | ||||||
|         let path = PathBuf::from(params.text_document_position_params.text_document.uri.path()); |         let path = PathBuf::from(params.text_document_position_params.text_document.uri.path()); | ||||||
|         let analysis = self.analysis.get(&path); |         let analysis = self.analysis.get(&path); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user