File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ class ImportNamespaceCommand(sublime_plugin.TextCommand):
1111 def run (self , edit ):
1212 projectPath = get_active_project_path ()
1313 file_name = self .view .file_name ().replace (projectPath , '' )
14- if file_name .startswith ('/' ):
14+ if file_name .startswith ('/' ) or file_name . startswith ( ' \\ ' ) :
1515 file_name = file_name [1 :]
1616
1717 # Abort if the file is not PHP
Original file line number Diff line number Diff line change @@ -83,17 +83,19 @@ def get_composer():
8383def get_namespace (filename ):
8484 data = get_composer ()
8585 for _replace_with , _path in data ['autoload' ]['psr-4' ].items ():
86+ _path = normalize_to_system_style_path (_path )
8687 if _path .startswith ('./' ):
87- _path = _path [2 :]
88+ _path = _path [2 :]
8889
8990 if filename .startswith (_path ):
9091 namespace = filename .replace (_path , _replace_with )
9192 namespace = re .sub ('/' , '\\ \\ ' , namespace )
9293 return namespace .strip ("\\ " ).replace ('\\ \\ ' , '\\ ' )
9394
9495 for _replace_with , _path in data ['autoload-dev' ]['psr-4' ].items ():
96+ _path = normalize_to_system_style_path (_path )
9597 if _path .startswith ('./' ):
96- _path = _path [2 :]
98+ _path = _path [2 :]
9799
98100 if filename .startswith (_path ):
99101 namespace = filename .replace (_path , _replace_with )
You can’t perform that action at this time.
0 commit comments