Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: re-export the items needed for the lsp from the fm crate instead of importing codespan_reporting #3757

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions compiler/fm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ mod file_map;
mod file_reader;

pub use file_map::{File, FileId, FileMap, PathString};

// Re-export for the lsp
pub use codespan_reporting::files as codespan_files;

use file_reader::is_stdlib_asset;
pub use file_reader::FileReader;

Expand Down
1 change: 0 additions & 1 deletion tooling/lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ license.workspace = true
[dependencies]
acvm.workspace = true
codespan-lsp.workspace = true
codespan-reporting.workspace = true
lsp-types.workspace = true
nargo.workspace = true
nargo_fmt.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion tooling/lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use async_lsp::{
router::Router, AnyEvent, AnyNotification, AnyRequest, ClientSocket, Error, LspService,
ResponseError,
};
use codespan_reporting::files;
use fm::codespan_files as files;
use noirc_frontend::{
graph::{CrateId, CrateName},
hir::{Context, FunctionNameMatch},
Expand Down
6 changes: 3 additions & 3 deletions tooling/lsp/src/requests/goto_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::future::{self, Future};

use crate::{types::GotoDefinitionResult, LspState};
use async_lsp::{ErrorCode, LanguageClient, ResponseError};
use codespan_reporting::files::Error;
use fm::codespan_files::Error;
use lsp_types::{GotoDefinitionParams, GotoDefinitionResponse, Location};
use lsp_types::{Position, Url};
use nargo_toml::{find_package_manifest, resolve_workspace_from_toml, PackageSelection};
Expand Down Expand Up @@ -98,7 +98,7 @@ fn to_lsp_location<'a, F>(
definition_span: noirc_errors::Span,
) -> Option<Location>
where
F: codespan_reporting::files::Files<'a> + ?Sized,
F: fm::codespan_files::Files<'a> + ?Sized,
{
let range = crate::byte_span_to_range(files, file_id, definition_span.into())?;
let file_name = files.name(file_id).ok()?;
Expand All @@ -115,7 +115,7 @@ pub(crate) fn position_to_byte_index<'a, F>(
position: &Position,
) -> Result<usize, Error>
where
F: codespan_reporting::files::Files<'a> + ?Sized,
F: fm::codespan_files::Files<'a> + ?Sized,
{
let source = files.source(file_id)?;
let source = source.as_ref();
Expand Down
Loading