-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from msamgan/v0.0.7
format individual file.
- Loading branch information
Showing
5 changed files
with
113 additions
and
29 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
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,3 @@ | ||
module.exports = { | ||
PINT_BINARY: "vendor/bin/pint" | ||
} |
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,46 @@ | ||
const vscode = require("vscode") | ||
const { PINT_BINARY } = require("./constants") | ||
const fs = require("fs") | ||
const path = require("path") | ||
|
||
/** | ||
* Returns the path to the project directory. | ||
* @returns {string} The path to the project directory. | ||
*/ | ||
exports.projectDirectory = () => { | ||
return vscode.workspace.workspaceFolders[0].uri.path | ||
} | ||
|
||
/** | ||
* Returns the current editor's file name. | ||
* @returns {string} The current editor's file name. | ||
*/ | ||
exports.currentEditor = () => { | ||
return vscode.window.activeTextEditor.document.fileName | ||
} | ||
|
||
/** | ||
* Checks if the pint binary is installed on the system. | ||
* @returns {boolean} - true if the binary is installed, false otherwise. | ||
*/ | ||
exports.checkBinaryExist = () => { | ||
return fs.existsSync(path.join(this.projectDirectory(), PINT_BINARY)) ? true : false | ||
} | ||
|
||
/** | ||
* Displays a message to the user. | ||
* @param {string} message - the message to display | ||
* @returns None | ||
*/ | ||
exports.infoMessage = (message) => { | ||
return vscode.window.showInformationMessage(message) | ||
} | ||
|
||
/** | ||
* Displays an error message to the user. | ||
* @param {string} message - the message to display to the user | ||
* @returns None | ||
*/ | ||
exports.errorMessage = (message) => { | ||
return vscode.window.showErrorMessage(message) | ||
} |