diff --git a/client/extension.ts b/client/extension.ts
index 8df1c67..795a6c3 100644
--- a/client/extension.ts
+++ b/client/extension.ts
@@ -279,7 +279,7 @@ async function findLastLogFile(context: ExtensionContext, pid: number) {
return path.join(directory, logFiles[0]);
}
-async function displayCrashMessage(context: ExtensionContext, crashInfo: string, pid = 0, command: string = null, outputChannel = global.LSCLIENT.outputChannel) {
+async function displayCrashMessage(context: ExtensionContext, crashInfo: string, pid = 0, recentMessages: string = null, command: string = null, outputChannel = global.LSCLIENT.outputChannel) {
// Capture the content of the file active when the crash happened
let activeFile: TextDocument;
if (window.activeTextEditor) {
@@ -298,7 +298,7 @@ async function displayCrashMessage(context: ExtensionContext, crashInfo: string,
switch (selection) {
case ("Send crash report"):
- CrashReportWebView.render(context, activeFile, crashInfo, command, log_file);
+ CrashReportWebView.render(context, activeFile, crashInfo, command, log_file, recentMessages);
break
case ("Open logs"):
outputChannel.show();
@@ -367,7 +367,7 @@ async function initLanguageServerClient(context: ExtensionContext, outputChannel
);
}),
client.onNotification("Odoo/displayCrashNotification", async (params) => {
- await displayCrashMessage(context, params["crashInfo"], params["pid"]);
+ await displayCrashMessage(context, params["crashInfo"], params["pid"], params["recentMessages"]);
}),
client.onNotification("$Odoo/restartNeeded", async () => {
if (global.LSCLIENT) {
@@ -385,7 +385,7 @@ async function initLanguageServerClient(context: ExtensionContext, outputChannel
} catch (error) {
outputChannel.appendLine("Couldn't Start Language server.");
outputChannel.appendLine(error);
- await displayCrashMessage(context, error, global.SERVER_PID, 'initLanguageServer', outputChannel);
+ await displayCrashMessage(context, error, global.SERVER_PID, "N/A", 'initLanguageServer', outputChannel);
}
}
diff --git a/client/views/crash_report/body.html b/client/views/crash_report/body.html
index 26f52fe..2ed2638 100644
--- a/client/views/crash_report/body.html
+++ b/client/views/crash_report/body.html
@@ -15,7 +15,7 @@
Crash report
It seems like an unexpected crash happened and halted the execution of the Odoo VSCode extension.
- By sending this crash report you agree to send to the IAP Team the following information. Please review them carefully:
+ By sending this crash report you agree to send to the OdooLS Team the following information. Please review them carefully:
-
@@ -27,12 +27,15 @@
Crash report
-
Eventual additional information you've provided in this form.
+ -
+ The recent messages exchanged with the language server and client. These messages may contain snippets of code from the currently opened document, but only if they were part of the messages exchanged with the language server.
+
Crash ID
- You can send this ID to the IAP team when discussing an issue with them.
+ You can send this ID to the OdooLS team when discussing an issue with them.
diff --git a/client/views/crash_report/crashReport.ts b/client/views/crash_report/crashReport.ts
index dd8163f..3a48bd2 100644
--- a/client/views/crash_report/crashReport.ts
+++ b/client/views/crash_report/crashReport.ts
@@ -20,13 +20,14 @@ export class CrashReportWebView {
private readonly _error: String;
private readonly _command: String;
private readonly _debugFile: string;
+ private readonly _recentMessages: any;
/**
* The CrashReportWebView class private constructor (called only from the render method).
*
* @param panel A reference to the webview panel
* @param extensionUri The URI of the directory containing the extension
*/
- private constructor(panel: WebviewPanel, uid: String, context: vscode.ExtensionContext, document: vscode.TextDocument, error: String, command: String = null, debugFile: string) {
+ private constructor(panel: WebviewPanel, uid: String, context: vscode.ExtensionContext, document: vscode.TextDocument, error: String, command: String = null, debugFile: string, recentMessages: string = null) {
this._panel = panel;
this._context = context;
this._document = document;
@@ -34,6 +35,7 @@ export class CrashReportWebView {
this.UID = uid;
this._command = command;
this._debugFile = debugFile;
+ this._recentMessages = recentMessages;
// Set an event listener to listen for when the panel is disposed (i.e. when the user closes
// the panel or when the panel is closed programmatically)
@@ -52,7 +54,7 @@ export class CrashReportWebView {
*
* @param extensionUri The URI of the directory containing the extension.
*/
- public static render(context: vscode.ExtensionContext, document: vscode.TextDocument, error: String, command: String = null, debugFile: string) {
+ public static render(context: vscode.ExtensionContext, document: vscode.TextDocument, error: String, command: String = null, debugFile: string, recentMessages: any = null) {
if (!CrashReportWebView.panels) {
CrashReportWebView.panels = new Map();
}
@@ -71,7 +73,7 @@ export class CrashReportWebView {
}
);
const UID = crypto.randomBytes(8).toString('hex');
- CrashReportWebView.panels.set(UID, new CrashReportWebView(panel, UID, context, document, error, command, debugFile));
+ CrashReportWebView.panels.set(UID, new CrashReportWebView(panel, UID, context, document, error, command, debugFile, recentMessages));
}
/**
@@ -152,7 +154,7 @@ export class CrashReportWebView {
if (this._debugFile !== undefined) {
server_logs = fs.readFileSync(this._debugFile, 'base64');
}
- axios.post('https://iap-services.odoo.com/api/odools/vscode/2/crash_report', {
+ axios.post('https://iap-services.odoo.com/api/odools/vscode/3/crash_report', {
data: {
uid: this.UID,
ide: "vscode",
@@ -166,6 +168,7 @@ export class CrashReportWebView {
python_version: version,
configuration: configString,
command: this._command,
+ recent_messages: this._recentMessages? this._recentMessages : "",
}
});
this.dispose();