1515//! + new line
1616//! + schema init
1717
18- use std:: io;
19- use std:: { fs, path:: Path } ;
20-
2118use crate :: goto_def:: { find_def, find_symbol} ;
2219use indexmap:: IndexSet ;
2320use kclvm_ast:: ast:: { self , ImportStmt , Program , Stmt } ;
@@ -26,6 +23,8 @@ use kclvm_config::modfile::KCL_FILE_EXTENSION;
2623use kclvm_driver:: get_kcl_files;
2724use kclvm_driver:: toolchain:: { get_real_path_from_external, Metadata , Toolchain } ;
2825use kclvm_sema:: core:: global_state:: GlobalState ;
26+ use std:: io;
27+ use std:: { fs, path:: Path } ;
2928
3029use kclvm_error:: Position as KCLPos ;
3130use kclvm_sema:: builtin:: { BUILTIN_FUNCTIONS , STANDARD_SYSTEM_MODULES } ;
@@ -34,6 +33,7 @@ use kclvm_sema::core::scope::{LocalSymbolScopeKind, ScopeKind};
3433use kclvm_sema:: core:: symbol:: SymbolKind ;
3534use kclvm_sema:: resolver:: doc:: { parse_schema_doc_string, SchemaDoc } ;
3635use kclvm_sema:: ty:: { FunctionType , SchemaType , Type , TypeKind } ;
36+ use kclvm_utils:: path:: PathPrefix ;
3737use lsp_types:: { CompletionItem , CompletionItemKind , InsertTextFormat } ;
3838
3939use crate :: util:: { inner_most_expr_in_stmt, is_in_docstring} ;
@@ -252,7 +252,6 @@ fn completion_dot(
252252 if symbol. is_none ( ) {
253253 symbol = find_symbol ( pos, gs, false ) ;
254254 }
255-
256255 let def = match symbol {
257256 Some ( symbol_ref) => {
258257 if let SymbolKind :: Unresolved = symbol_ref. get_kind ( ) {
@@ -472,7 +471,6 @@ fn completion_import_stmt(
472471 line : pos. line ,
473472 column : Some ( 0 ) ,
474473 } ;
475-
476474 if let Some ( node) = program. pos_to_stmt ( line_start_pos) {
477475 if let Stmt :: Import ( _) = node. node {
478476 completions. extend ( completion_import_builtin_pkg ( ) ) ;
@@ -527,7 +525,9 @@ fn completion_import_internal_pkg(
527525 } else {
528526 // internal module
529527 let path = entry. path ( ) ;
530- if path. to_str ( ) . unwrap_or ( "" ) == line_start_pos. filename {
528+ if path. to_str ( ) . unwrap_or ( "" ) . adjust_canonicalization ( )
529+ == line_start_pos. filename . adjust_canonicalization ( )
530+ {
531531 continue ;
532532 }
533533 if let Some ( extension) = path. extension ( ) {
0 commit comments