Skip to content

Commit 1da8063

Browse files
author
Drizzy
committed
version 1.2.0
1 parent d33114c commit 1da8063

File tree

5 files changed

+33
-99
lines changed

5 files changed

+33
-99
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change Log
22

3+
### [v1.2.0](https://github.com/drizzy/vscode-code-make/releases/tag/v1.2.0)
4+
5+
> 02 December 2023
6+
7+
### Features
8+
9+
- Improved performance by avoiding frequent status bar updates
10+
- Commands and key assignments removed
11+
- Flags for compiling programs with SDL2 added to Makefile
12+
313
### [v1.1.0](https://github.com/drizzy/vscode-code-make/releases/tag/v1.1.0)
414

515
> 22 November 2023
@@ -12,12 +22,16 @@
1222

1323
> 01 February 2023
1424
25+
### Features
26+
1527
- Add flags in makefile
1628

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

1931
> 08 October 2022
2032
33+
### Features
34+
2135
- Problems creating projects on windows fixed
2236

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

3145
> 04 October 2022
3246
47+
### Features
48+
3349
- Initial release

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ Create C++ projects, compile, and run programs directly from the VSCode interfac
2222
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.
2323

2424

25-
## Keybindings
26-
27-
| Linux | Windows | Mac | Description |
28-
| ------------- | ------------- | ------------- | ------------------- |
29-
| ctrl+alt+f | ctrl+alt+f | ctrl+alt+f | Make Create Folder |
30-
| ctrl+alt+b | ctrl+alt+b | ctrl+alt+b | Make Build Folder |
31-
| ctrl+alt+r | ctrl+alt+r | ctrl+alt+r | Make Run Folder |
32-
| ctrl+alt+c | ctrl+alt+c | ctrl+alt+c | Make Clean Folder |
33-
| ctrl+alt+d | ctrl+alt+d | ctrl+alt+d | Make Delete Folder |
34-
35-
3625
## Release Notes
3726

3827
Refer to [CHANGELOG](CHANGELOG.md) for detailed release notes.

package.json

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "code-make",
33
"displayName": "Code Make",
4-
"description": "Creates c++ projects with configured Makefile",
5-
"version": "1.1.0",
4+
"description": "Code Make is designed to make it easy to create and compile C++ projects using the Make tool.",
5+
"version": "1.2.0",
66
"publisher": "drizzy",
77
"license": "MIT",
88
"icon": "icons/logo.png",
@@ -44,57 +44,6 @@
4444
"onCommand:code-make-destroy.run"
4545
],
4646
"main": "./extension.js",
47-
"contributes": {
48-
"commands": [
49-
{
50-
"command": "code-make.run",
51-
"title": "Make Run Folder"
52-
},
53-
{
54-
"command": "code-make-create.run",
55-
"title": "Make Create Folder"
56-
},
57-
{
58-
"command": "code-make-build.run",
59-
"title": "Make Build Folder"
60-
},
61-
{
62-
"command": "code-make-clean.run",
63-
"title": "Make Clean Folder"
64-
},
65-
{
66-
"command": "code-make-destroy.run",
67-
"title": "Make Delete Folder"
68-
}
69-
],
70-
"keybindings": [
71-
{
72-
"command": "code-make.run",
73-
"key": "ctrl+alt+r",
74-
"mac": "ctrl+alt+r"
75-
},
76-
{
77-
"command": "code-make-create.run",
78-
"key": "ctrl+alt+f",
79-
"mac": "ctrl+alt+f"
80-
},
81-
{
82-
"command": "code-make-build.run",
83-
"key": "ctrl+alt+b",
84-
"mac": "ctrl+alt+b"
85-
},
86-
{
87-
"command": "code-make-clean.run",
88-
"key": "ctrl+alt+c",
89-
"mac": "ctrl+alt+c"
90-
},
91-
{
92-
"command": "code-make-destroy.run",
93-
"key": "ctrl+alt+d",
94-
"mac": "ctrl+alt+d"
95-
}
96-
]
97-
},
9847
"scripts": {
9948
"lint": "eslint .",
10049
"pretest": "npm run lint",

src/items.js

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
const vscode = require('vscode');
22
const os = require('os');
33
const fs = require('fs');
4-
const events = require('events');
54
const path = require('path');
65
const workspace = vscode.workspace;
76
const window = vscode.window;
87
const commands = vscode.commands;
98

10-
/* Creating a new event emitter. */
11-
let eventEmitter = events.EventEmitter;
12-
13-
/* Creating a new event emitter. */
14-
let event = new eventEmitter();
15-
16-
/* Getting the path of the workspace folder. */
17-
let folderPath;
18-
if (!workspace.workspaceFolders) {
19-
folderPath = workspace.rootPath;
20-
}
21-
else {
22-
23-
let root;
24-
if (workspace.workspaceFolders.length === 1) {
25-
root = workspace.workspaceFolders[0];
26-
}
27-
else {
28-
root = workspace.getWorkspaceFolder(resource);
29-
}
30-
31-
folderPath = root.uri.fsPath;
32-
}
9+
let folderPath = workspace.workspaceFolders ? workspace.workspaceFolders[0].uri.fsPath : workspace.rootPath;
3310

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

26+
const srcPath = path.join(folderPath, 'src');
27+
const includePath = path.join(folderPath, 'include');
28+
const makefilePath = path.join(folderPath, 'Makefile');
29+
30+
const isProjectValid = fs.existsSync(srcPath) && fs.existsSync(includePath) && fs.existsSync(makefilePath);
31+
4932
items.work.text = `$(folder-active) ${workspace.name}`;
5033
items.work.command = null;
5134
items.work.color = '#FF79C6';
@@ -70,7 +53,7 @@ let updateStatusBar = function () {
7053
items.destroy.command = 'code-make-destroy.run';
7154
items.destroy.color = '#ED836E';
7255

73-
if (fs.existsSync(path.join(folderPath, 'src')) && fs.existsSync(path.join(folderPath, 'include')) && fs.existsSync(path.join(folderPath, 'Makefile'))){
56+
if (isProjectValid){
7457

7558
items.create.hide();
7659

@@ -103,15 +86,12 @@ let updateStatusBar = function () {
10386

10487
}
10588

106-
/* Listening for an event called 'update' and when it is triggered it will run the function
107-
`updateStatusBar`. */
108-
event.on('update', updateStatusBar);
89+
let watcher = vscode.workspace.createFileSystemWatcher('**/*', false, false, false);
90+
watcher.onDidChange(updateStatusBar);
91+
watcher.onDidCreate(updateStatusBar);
92+
watcher.onDidDelete(updateStatusBar);
10993

110-
/* Updating the status bar every 500 milliseconds. */
111-
setInterval( () => {
112-
event.emit('update', Date.now());
113-
},500
114-
);
94+
updateStatusBar();
11595

11696
module.exports = {
11797
os,

src/template/makefile.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ APPNAME := Example
55
CXX := g++
66

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

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

1212
# define bin directory
1313
BIN := bin

0 commit comments

Comments
 (0)