File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " @biomejs/biome " : patch
3+ ---
4+
5+ Fixed [ #10694 ] ( https://github.com/biomejs/biome/issues/10694 ) . The Biome Language Server no longer prints an error when the user hovers a variable imported from node_modules.
Original file line number Diff line number Diff line change @@ -51,7 +51,12 @@ pub(crate) fn goto_definition(
5151 path : path. clone ( ) ,
5252 cursor_range,
5353 enabled,
54- } ) ?;
54+ } ) ;
55+ // The feature might not have access to all files per design e.g. node_modules dependencies.
56+ // This will return a `Result`, but we shouldn't bubble it as an error to the user.
57+ let Ok ( result) = result else {
58+ return Ok ( None ) ;
59+ } ;
5560
5661 match result {
5762 Some ( definition) => {
Original file line number Diff line number Diff line change @@ -742,4 +742,38 @@ async fn goto_definition_css_cross_file_multiple_definitions() -> Result<()> {
742742 Ok ( ( ) )
743743}
744744
745+ #[ tokio:: test]
746+ async fn goto_definition_node_modules_import_does_not_error ( ) -> Result < ( ) > {
747+ // Regression test for https://github.com/biomejs/biome/issues/10694.
748+ //
749+ // Line 0: `import { helper } from 'external-pkg';`
750+ // 0123456789 → `helper` starts at char 9
751+ let ( res, _fs) = goto_definition_cross_file ( CrossFileTestParams {
752+ name : "goto_definition_node_modules_import_does_not_error" ,
753+ config : r#"{ "linter": { "enabled": true } }"# ,
754+ files : vec ! [
755+ (
756+ "node_modules/external-pkg/index.js" ,
757+ "export function helper() {}\n " ,
758+ ) ,
759+ (
760+ "main.js" ,
761+ "import { helper } from 'external-pkg';\n helper();\n " ,
762+ ) ,
763+ ] ,
764+ open_file : "main.js" ,
765+ language_id : "javascript" ,
766+ source : "import { helper } from 'external-pkg';\n helper();\n " ,
767+ cursor : pos ( 0 , 9 ) ,
768+ } )
769+ . await ?;
770+
771+ assert ! (
772+ res. is_none( ) ,
773+ "go-to definition on a node_modules import should resolve to None, not error"
774+ ) ;
775+
776+ Ok ( ( ) )
777+ }
778+
745779// #endregion
You can’t perform that action at this time.
0 commit comments