MCPcopy Index your code
hub / github.com/VSpaceCode/VSpaceCode / _getPath

Function _getPath

src/pathCommands.ts:68–82  ·  view source on GitHub ↗
(activeEditor: TextEditor, relative: boolean)

Source from the content-addressed store, hash-verified

66}
67
68function _getPath(activeEditor: TextEditor, relative: boolean) {
69 const uri = activeEditor.document.uri;
70 let fsPath = relative ? relativePathToWorkspace(uri) : uriToFsPath(uri);
71
72 const platformPath = getPlatformPath(uri);
73 if (platformPath === path.win32) {
74 // Replace all / to \
75 fsPath = fsPath.replace(/\//g, "\\");
76 }
77
78 const activePos = activeEditor.selection.active;
79 const line = activePos.line;
80 const col = activePos.character;
81 return { fsPath, path: platformPath, line, col };
82}
83
84function hasDriveLetter(fsPath: string, offset = 0): boolean {
85 if (fsPath.length >= 2 + offset) {

Callers 10

getPathFunction · 0.85
getPathWithLineFunction · 0.85
getPathWithLineColumnFunction · 0.85
getDirectoryPathFunction · 0.85
getRelativePathFunction · 0.85
getRelativePathWithLineFunction · 0.85
getRelativeDirectoryPathFunction · 0.85
getFilenameFunction · 0.85
getFilenameBaseFunction · 0.85

Calls 3

relativePathToWorkspaceFunction · 0.85
uriToFsPathFunction · 0.85
getPlatformPathFunction · 0.85

Tested by

no test coverage detected