-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feature to src folder of settings #61
- Loading branch information
1 parent
b7a421b
commit 8eaa852
Showing
5 changed files
with
63 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export class StringUtils { | ||
text: string; | ||
constructor(text: string){ | ||
this.text = text; | ||
} | ||
public titleCase(): StringUtils { | ||
this.text = this.text.replace(/\w+/g, function (txt) { | ||
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | ||
}); | ||
return this; | ||
} | ||
public removeSpecialChars(): StringUtils { | ||
this.text = this.text.replace(/[^\w]/g, ''); | ||
return this; | ||
} | ||
public value(){ | ||
return this.text; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { join } from "path"; | ||
import { workspace, WorkspaceFolder } from "vscode"; | ||
|
||
export class WorkspaceUtils { | ||
public static getFullFsPathOfRelativePath(relativeFolder: string, fileName: string) { | ||
let relativeFsPath: string = join(relativeFolder, fileName); | ||
let fullFsPath: string; | ||
if (!workspace.workspaceFolders) | ||
throw new Error('No workspacefolder opened.'); | ||
if (workspace.workspaceFile) { | ||
fullFsPath = join(workspace.workspaceFile.fsPath, relativeFsPath); | ||
} else if (workspace.workspaceFolders.length == 1) { | ||
let workspaceFolder: WorkspaceFolder = workspace.workspaceFolders[0]; | ||
fullFsPath = join(workspaceFolder.uri.fsPath, relativeFsPath); | ||
} else { | ||
throw new Error('Expected to find the workspacefolder.') | ||
} | ||
return fullFsPath; | ||
} | ||
} |