Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"mocha": true
},
"parserOptions": {
"ecmaVersion": 2018,
"ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true
},
Expand Down
61 changes: 34 additions & 27 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,43 @@ function activate(context) {
statusBarItem.show();

// if there is a folder loaded, initialize codealike
if (vscode.workspace.rootPath) {
statusBarItem.text = "Codealike is initializing...";
if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) {
const rootPath = vscode.workspace.workspaceFolders[0].uri.fsPath;

if (rootPath) {
statusBarItem.text = "Codealike is initializing...";

// initialize plugin for current client and version
Codealike.initialize('vscode', '0.0.26');
// initialize plugin for current client and version
Codealike.initialize('vscode', '0.0.27');

Codealike.registerStateSubscriber((state) => {
if (state.isTracking) {
if (state.networkStatus === 'OnLine') {
statusBarItem.text = "Codealike is tracking on-line";
Codealike.registerStateSubscriber((state) => {
if (state.isTracking) {
if (state.networkStatus === 'OnLine') {
statusBarItem.text = "Codealike is tracking on-line";
}
else {
statusBarItem.text = "Codealike is tracking off-line";
}
}
else {
statusBarItem.text = "Codealike is tracking off-line";
statusBarItem.text = "Click here to configure Codealike";
}
}
else {
statusBarItem.text = "Click here to configure Codealike";
}
});
});


// try to connect
Codealike.connect()
.then(
() => {
startTrackingProject();
},
() => {
stopTrackingProject();
}
);
// try to connect
Codealike.connect()
.then(
() => {
startTrackingProject();
},
() => {
stopTrackingProject();
}
);
}else{

}

}

Expand Down Expand Up @@ -115,7 +122,7 @@ function startTrackingProject() {

// start tracking project
Codealike
.configure(vscode.workspace.workspaceFolders[0].uri.fsPath)
.configure(vscode.workspace.workspaceFolders[0].uri.fsPath) // get currently active work spaces...
.then(
(configuration) => {
// calculate when workspace started loading
Expand Down Expand Up @@ -150,8 +157,8 @@ function startTrackingProject() {

results.forEach(element => {
if (!element) return;
if (!element.location || !element.location.range) return;
if (!element.location.range._start?.line) {
if (!element?.location || !element?.location.range) return;
if (!element?.location.range._start?.line) {
return;
}
const rangeLine = element.location.range._start.line;
Expand Down
Loading