mirror of
https://github.com/denoland/deno.git
synced 2025-03-06 02:52:05 -05:00
cleanup
This commit is contained in:
parent
f8e8f251a4
commit
1a0a61d059
5 changed files with 10 additions and 18 deletions
|
@ -113,7 +113,6 @@ export class Context {
|
|||
|
||||
op_lint_report(
|
||||
this.id,
|
||||
this.fileName,
|
||||
data.message,
|
||||
start,
|
||||
end,
|
||||
|
|
|
@ -5,7 +5,6 @@ use super::diagnostics::DiagnosticSource;
|
|||
use super::documents::Document;
|
||||
use super::documents::Documents;
|
||||
use super::language_server;
|
||||
use super::logging::lsp_log;
|
||||
use super::resolver::LspResolver;
|
||||
use super::tsc;
|
||||
use super::urls::url_to_uri;
|
||||
|
|
|
@ -3090,7 +3090,6 @@ impl tower_lsp::LanguageServer for LanguageServer {
|
|||
self.init_flag.raise();
|
||||
|
||||
for registration in registrations {
|
||||
lsp_log!("{}", format!("registration {:#?}", registration));
|
||||
if let Err(err) = self
|
||||
.client
|
||||
.when_outside_lsp_lock()
|
||||
|
@ -3099,7 +3098,6 @@ impl tower_lsp::LanguageServer for LanguageServer {
|
|||
{
|
||||
lsp_warn!("Client errored on capabilities.\n{:#}", err);
|
||||
}
|
||||
lsp_log!("registration finished");
|
||||
}
|
||||
|
||||
if upgrade_check_enabled() {
|
||||
|
|
|
@ -28,6 +28,8 @@ deno_core::extension!(
|
|||
options = {
|
||||
logger: PluginLogger,
|
||||
},
|
||||
// TODO(bartlomieju): this should only be done,
|
||||
// if not in the "test worker".
|
||||
middleware = |op| match op.name {
|
||||
"op_print" => op_print(),
|
||||
_ => op,
|
||||
|
@ -42,19 +44,14 @@ deno_core::extension!(
|
|||
pub struct LintPluginContainer {
|
||||
pub diagnostics: Vec<LintDiagnostic>,
|
||||
pub source_text_info: Option<SourceTextInfo>,
|
||||
token: CancellationToken,
|
||||
pub specifier: Option<ModuleSpecifier>,
|
||||
pub token: CancellationToken,
|
||||
}
|
||||
|
||||
impl LintPluginContainer {
|
||||
fn report(
|
||||
&mut self,
|
||||
id: String,
|
||||
specifier: String,
|
||||
message: String,
|
||||
start: usize,
|
||||
end: usize,
|
||||
) {
|
||||
fn report(&mut self, id: String, message: String, start: usize, end: usize) {
|
||||
let source_text_info = self.source_text_info.as_ref().unwrap();
|
||||
let specifier = self.specifier.clone().unwrap();
|
||||
let start_pos = source_text_info.start_pos();
|
||||
let source_range = SourceRange::new(start_pos + start, start_pos + end);
|
||||
let range = LintDiagnosticRange {
|
||||
|
@ -63,9 +60,7 @@ impl LintPluginContainer {
|
|||
text_info: source_text_info.clone(),
|
||||
};
|
||||
let lint_diagnostic = LintDiagnostic {
|
||||
// TODO: fix
|
||||
specifier: ModuleSpecifier::parse(&format!("file:///{}", specifier))
|
||||
.unwrap(),
|
||||
specifier,
|
||||
range: Some(range),
|
||||
details: LintDiagnosticDetails {
|
||||
message,
|
||||
|
@ -124,13 +119,12 @@ fn op_lint_create_serialized_ast(
|
|||
fn op_lint_report(
|
||||
state: &mut OpState,
|
||||
#[string] id: String,
|
||||
#[string] specifier: String,
|
||||
#[string] message: String,
|
||||
#[smi] start: usize,
|
||||
#[smi] end: usize,
|
||||
) {
|
||||
let container = state.borrow_mut::<LintPluginContainer>();
|
||||
container.report(id, specifier, message, start, end);
|
||||
container.report(id, message, start, end);
|
||||
}
|
||||
|
||||
#[op2]
|
||||
|
|
|
@ -271,6 +271,8 @@ impl PluginRunner {
|
|||
let mut state = state.borrow_mut();
|
||||
let container = state.borrow_mut::<LintPluginContainer>();
|
||||
container.source_text_info = Some(source_text_info);
|
||||
container.specifier =
|
||||
Some(ModuleSpecifier::from_file_path(specifier).unwrap());
|
||||
}
|
||||
|
||||
let (file_name_v8, ast_uint8arr_v8) = {
|
||||
|
|
Loading…
Add table
Reference in a new issue