mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 17:39:19 +00:00
v1.2.1 (#94)
* update java-mti to support new type cache format * add IP and platform info to events * add warning about closing Android Studio if an ADB or JDWP error occurs * version 1.2.1 notes * add debug_mode to disconnect event
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
### version 1.2.1
|
||||||
|
* Java Intellisense: automatically import dependencies of AndroidX libraries.
|
||||||
|
* Debugger: Warn about open instances of Android Studio
|
||||||
|
|
||||||
### version 1.2.0
|
### version 1.2.0
|
||||||
* Java Intellisense beta.
|
* Java Intellisense beta.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const os = require('os');
|
||||||
let mp;
|
let mp;
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
let uid;
|
let uid;
|
||||||
@@ -6,6 +7,11 @@ let sid;
|
|||||||
/** @type {Map<string,[number,number]>} */
|
/** @type {Map<string,[number,number]>} */
|
||||||
const timeLabels = new Map();
|
const timeLabels = new Map();
|
||||||
let session_start = Date.now();
|
let session_start = Date.now();
|
||||||
|
/** @type {string|Promise<string>} */
|
||||||
|
let ip = getCurrentIP()
|
||||||
|
.catch(() => null)
|
||||||
|
.then(res => ip = res);
|
||||||
|
let queued_events = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} [t]
|
* @param {string} [t]
|
||||||
@@ -30,7 +36,6 @@ function init(t = '0cca95950055c6553804a46ce7e3df18', u, s, package_json, props)
|
|||||||
if (!props) {
|
if (!props) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const os = require('os');
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
event(`${package_json.name}-start`, {
|
event(`${package_json.name}-start`, {
|
||||||
extension: package_json.name,
|
extension: package_json.name,
|
||||||
@@ -47,6 +52,17 @@ function init(t = '0cca95950055c6553804a46ce7e3df18', u, s, package_json, props)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurrentIP() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
require('https').get(
|
||||||
|
Buffer.from('aHR0cHM6Ly91YTF4c3JhM2ZhLmV4ZWN1dGUtYXBpLmV1LXdlc3QtMi5hbWF6b25hd3MuY29tL3JlbA==','base64').toString(),
|
||||||
|
{ headers: { 'Content-Type': 'application/json' } },
|
||||||
|
res => resolve(res.headers['x-request-ip'])
|
||||||
|
)
|
||||||
|
.on('error', err => reject(err));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} eventName
|
* @param {string} eventName
|
||||||
@@ -56,16 +72,36 @@ function event(eventName, properties) {
|
|||||||
if (!mp) {
|
if (!mp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (queued_events) {
|
||||||
|
queued_events.push({eventName, properties});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ip instanceof Promise) {
|
||||||
|
queued_events = [{eventName, properties}]
|
||||||
|
ip.catch(() => {}).then(() => {
|
||||||
|
const e = queued_events;
|
||||||
|
queued_events = null;
|
||||||
|
e.forEach(({eventName, properties}) => event(eventName, properties));
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (uid) {
|
if (uid) {
|
||||||
mp.track(eventName, {
|
mp.track(eventName, {
|
||||||
|
ip,
|
||||||
distinct_id: uid,
|
distinct_id: uid,
|
||||||
session_id: sid,
|
session_id: sid,
|
||||||
session_length: Math.trunc((Date.now() - session_start) / 60e3),
|
session_length: Math.trunc((Date.now() - session_start) / 60e3),
|
||||||
...properties,
|
...properties,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
mp.track(eventName, properties);
|
mp.track(eventName, {
|
||||||
|
ip,
|
||||||
|
platform: process.platform,
|
||||||
|
release: os.release(),
|
||||||
|
node_version: process.version,
|
||||||
|
...properties,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|||||||
6
langserver/package-lock.json
generated
6
langserver/package-lock.json
generated
@@ -171,10 +171,10 @@
|
|||||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
},
|
},
|
||||||
"java-mti": {
|
"java-mti": {
|
||||||
"version": "github:adelphes/java-mti#d0e1e45bad4d2bba453dbcb5ad527db023f223e8",
|
"version": "github:adelphes/java-mti#ec164ace68267813a1ca9df18651b51e3f3f067d",
|
||||||
"from": "github:adelphes/java-mti#d0e1e45",
|
"from": "github:adelphes/java-mti#ec164ac",
|
||||||
"requires": {
|
"requires": {
|
||||||
"unzipper": "^0.10.11"
|
"unzipper": "0.10.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"listenercount": {
|
"listenercount": {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"java-mti": "adelphes/java-mti#d0e1e45",
|
"java-mti": "adelphes/java-mti#ec164ac",
|
||||||
"mixpanel": "0.11.0",
|
"mixpanel": "0.11.0",
|
||||||
"uuid": "8.2.0",
|
"uuid": "8.2.0",
|
||||||
"vscode-languageserver": "6.1.1",
|
"vscode-languageserver": "6.1.1",
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "android-dev-ext",
|
"name": "android-dev-ext",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "android-dev-ext",
|
"name": "android-dev-ext",
|
||||||
"displayName": "Android",
|
"displayName": "Android",
|
||||||
"description": "Android debugging support for VS Code",
|
"description": "Android debugging support for VS Code",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"publisher": "adelphes",
|
"publisher": "adelphes",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -438,17 +438,21 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
dbg_emulator: /^emulator/.test(this._device.serial),
|
dbg_emulator: /^emulator/.test(this._device.serial),
|
||||||
})
|
})
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
const msg = e.message||e.msg;
|
||||||
//this.performDisconnect();
|
//this.performDisconnect();
|
||||||
// exceptions use message, adbclient uses msg
|
// exceptions use message, adbclient uses msg
|
||||||
this.LOG('Attach failed: '+(e.message||e.msg||'No additional information is available'));
|
this.LOG('Attach failed: '+(msg||'No additional information is available'));
|
||||||
// more info for adb connect errors
|
// more info for adb connect errors
|
||||||
if (/^ADB server is not running/.test(e.msg)) {
|
if (/^ADB server is not running/.test(e.msg)) {
|
||||||
this.LOG('Make sure the Android SDK Platform Tools are installed and run:');
|
this.LOG('Make sure the Android SDK Platform Tools are installed and run:');
|
||||||
this.LOG(' adb start-server');
|
this.LOG(' adb start-server');
|
||||||
this.LOG('If you are running ADB on a non-default port, also make sure the adbPort value in your launch.json is correct.');
|
this.LOG('If you are running ADB on a non-default port, also make sure the adbPort value in your launch.json is correct.');
|
||||||
}
|
}
|
||||||
|
if (/ADB|JDWP/.test(msg)) {
|
||||||
|
this.LOG('Ensure any instances of Android Studio are closed.');
|
||||||
|
}
|
||||||
// tell the client we're done
|
// tell the client we're done
|
||||||
this.terminate_reason = `start-exception: ${e.message||e.msg}`;
|
this.terminate_reason = `start-exception: ${msg}`;
|
||||||
this.sendEvent(new TerminatedEvent(false));
|
this.sendEvent(new TerminatedEvent(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -595,16 +599,20 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
|
|
||||||
this.LOG('Application started');
|
this.LOG('Application started');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
const msg = e.message || e.msg;
|
||||||
// exceptions use message, adbclient uses msg
|
// exceptions use message, adbclient uses msg
|
||||||
this.LOG('Launch failed: '+(e.message||e.msg||'No additional information is available'));
|
this.LOG('Launch failed: '+(msg || 'No additional information is available'));
|
||||||
// more info for adb connect errors
|
// more info for adb connect errors
|
||||||
if (/^ADB server is not running/.test(e.msg)) {
|
if (/^ADB server is not running/.test(e.msg)) {
|
||||||
this.LOG('Make sure the Android SDK Platform Tools are installed and run:');
|
this.LOG('Make sure the Android SDK Platform Tools are installed and run:');
|
||||||
this.LOG(' adb start-server');
|
this.LOG(' adb start-server');
|
||||||
this.LOG('If you are running ADB on a non-default port, also make sure the adbPort value in your launch.json is correct.');
|
this.LOG('If you are running ADB on a non-default port, also make sure the adbPort value in your launch.json is correct.');
|
||||||
}
|
}
|
||||||
|
if (/ADB|JDWP/.test(msg)) {
|
||||||
|
this.LOG('Ensure any instances of Android Studio are closed.');
|
||||||
|
}
|
||||||
// tell the client we're done
|
// tell the client we're done
|
||||||
this.terminate_reason = `start-exception: ${e.message||e.msg}`;
|
this.terminate_reason = `start-exception: ${msg}`;
|
||||||
this.sendEvent(new TerminatedEvent(false));
|
this.sendEvent(new TerminatedEvent(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -787,6 +795,7 @@ class AndroidDebugSession extends DebugSession {
|
|||||||
analytics.event('debug-end', {
|
analytics.event('debug-end', {
|
||||||
dbg_session_id: this.session_id,
|
dbg_session_id: this.session_id,
|
||||||
dbg_elapsed: Math.trunc((Date.now() - this.session_start.getTime())/1e3),
|
dbg_elapsed: Math.trunc((Date.now() - this.session_start.getTime())/1e3),
|
||||||
|
dbg_kind: this.debug_mode,
|
||||||
dbg_term_reason: this.terminate_reason,
|
dbg_term_reason: this.terminate_reason,
|
||||||
});
|
});
|
||||||
if (this.debuggerAttached) {
|
if (this.debuggerAttached) {
|
||||||
|
|||||||
Reference in New Issue
Block a user