Skip to content

Commit

Permalink
version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Drizzy committed Dec 2, 2023
1 parent d33114c commit 1da8063
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 99 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

### [v1.2.0](https://github.com/drizzy/vscode-code-make/releases/tag/v1.2.0)

> 02 December 2023
### Features

- Improved performance by avoiding frequent status bar updates
- Commands and key assignments removed
- Flags for compiling programs with SDL2 added to Makefile

### [v1.1.0](https://github.com/drizzy/vscode-code-make/releases/tag/v1.1.0)

> 22 November 2023
Expand All @@ -12,12 +22,16 @@

> 01 February 2023
### Features

- Add flags in makefile

### [v1.0.1](https://github.com/drizzy/vscode-code-make/releases/tag/v1.0.1)

> 08 October 2022
### Features

- Problems creating projects on windows fixed

- Brief documentation to be able to install `make`
Expand All @@ -30,4 +44,6 @@

> 04 October 2022
### Features

- Initial release
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ Create C++ projects, compile, and run programs directly from the VSCode interfac
After installing the extension, click on the `+` symbol in the bottom left corner to create a C++ project structure. Use the gear wheel to compile, the play symbol to run the program, the trash can to delete files from the `bin` and `obj` directories, and 'x' to delete both directories.


## Keybindings

| Linux | Windows | Mac | Description |
| ------------- | ------------- | ------------- | ------------------- |
| ctrl+alt+f | ctrl+alt+f | ctrl+alt+f | Make Create Folder |
| ctrl+alt+b | ctrl+alt+b | ctrl+alt+b | Make Build Folder |
| ctrl+alt+r | ctrl+alt+r | ctrl+alt+r | Make Run Folder |
| ctrl+alt+c | ctrl+alt+c | ctrl+alt+c | Make Clean Folder |
| ctrl+alt+d | ctrl+alt+d | ctrl+alt+d | Make Delete Folder |


## Release Notes

Refer to [CHANGELOG](CHANGELOG.md) for detailed release notes.
55 changes: 2 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "code-make",
"displayName": "Code Make",
"description": "Creates c++ projects with configured Makefile",
"version": "1.1.0",
"description": "Code Make is designed to make it easy to create and compile C++ projects using the Make tool.",
"version": "1.2.0",
"publisher": "drizzy",
"license": "MIT",
"icon": "icons/logo.png",
Expand Down Expand Up @@ -44,57 +44,6 @@
"onCommand:code-make-destroy.run"
],
"main": "./extension.js",
"contributes": {
"commands": [
{
"command": "code-make.run",
"title": "Make Run Folder"
},
{
"command": "code-make-create.run",
"title": "Make Create Folder"
},
{
"command": "code-make-build.run",
"title": "Make Build Folder"
},
{
"command": "code-make-clean.run",
"title": "Make Clean Folder"
},
{
"command": "code-make-destroy.run",
"title": "Make Delete Folder"
}
],
"keybindings": [
{
"command": "code-make.run",
"key": "ctrl+alt+r",
"mac": "ctrl+alt+r"
},
{
"command": "code-make-create.run",
"key": "ctrl+alt+f",
"mac": "ctrl+alt+f"
},
{
"command": "code-make-build.run",
"key": "ctrl+alt+b",
"mac": "ctrl+alt+b"
},
{
"command": "code-make-clean.run",
"key": "ctrl+alt+c",
"mac": "ctrl+alt+c"
},
{
"command": "code-make-destroy.run",
"key": "ctrl+alt+d",
"mac": "ctrl+alt+d"
}
]
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
Expand Down
46 changes: 13 additions & 33 deletions src/items.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,12 @@
const vscode = require('vscode');
const os = require('os');
const fs = require('fs');
const events = require('events');
const path = require('path');
const workspace = vscode.workspace;
const window = vscode.window;
const commands = vscode.commands;

/* Creating a new event emitter. */
let eventEmitter = events.EventEmitter;

/* Creating a new event emitter. */
let event = new eventEmitter();

/* Getting the path of the workspace folder. */
let folderPath;
if (!workspace.workspaceFolders) {
folderPath = workspace.rootPath;
}
else {

let root;
if (workspace.workspaceFolders.length === 1) {
root = workspace.workspaceFolders[0];
}
else {
root = workspace.getWorkspaceFolder(resource);
}

folderPath = root.uri.fsPath;
}
let folderPath = workspace.workspaceFolders ? workspace.workspaceFolders[0].uri.fsPath : workspace.rootPath;

/* Creating a new status bar item for each of the commands. */
let items = {
Expand All @@ -46,6 +23,12 @@ let items = {
*/
let updateStatusBar = function () {

const srcPath = path.join(folderPath, 'src');
const includePath = path.join(folderPath, 'include');
const makefilePath = path.join(folderPath, 'Makefile');

const isProjectValid = fs.existsSync(srcPath) && fs.existsSync(includePath) && fs.existsSync(makefilePath);

items.work.text = `$(folder-active) ${workspace.name}`;
items.work.command = null;
items.work.color = '#FF79C6';
Expand All @@ -70,7 +53,7 @@ let updateStatusBar = function () {
items.destroy.command = 'code-make-destroy.run';
items.destroy.color = '#ED836E';

if (fs.existsSync(path.join(folderPath, 'src')) && fs.existsSync(path.join(folderPath, 'include')) && fs.existsSync(path.join(folderPath, 'Makefile'))){
if (isProjectValid){

items.create.hide();

Expand Down Expand Up @@ -103,15 +86,12 @@ let updateStatusBar = function () {

}

/* Listening for an event called 'update' and when it is triggered it will run the function
`updateStatusBar`. */
event.on('update', updateStatusBar);
let watcher = vscode.workspace.createFileSystemWatcher('**/*', false, false, false);
watcher.onDidChange(updateStatusBar);
watcher.onDidCreate(updateStatusBar);
watcher.onDidDelete(updateStatusBar);

/* Updating the status bar every 500 milliseconds. */
setInterval( () => {
event.emit('update', Date.now());
},500
);
updateStatusBar();

module.exports = {
os,
Expand Down
4 changes: 2 additions & 2 deletions src/template/makefile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ APPNAME := Example
CXX := g++

# define the FLAGS
CFLAGS := -Wall $(shell pkg-config gtkmm-3.0 --cflags)
CFLAGS := -Wall $(shell pkg-config gtkmm-3.0 sdl2 --cflags)

LFLAGS := $(shell pkg-config gtkmm-3.0 --libs)
LFLAGS := $(shell pkg-config gtkmm-3.0 sdl2 --libs) -lSDL2_image

# define bin directory
BIN := bin
Expand Down

0 comments on commit 1da8063

Please sign in to comment.