Skip to content
Open
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
8 changes: 4 additions & 4 deletions client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}
}

Expand Down
7 changes: 5 additions & 2 deletions client/views/crash_report/body.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1>Crash report</h1>
<p>
It seems like an unexpected crash happened and halted the execution of the Odoo VSCode extension.
<br/>
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:
</p>
<ul>
<li>
Expand All @@ -27,12 +27,15 @@ <h1>Crash report</h1>
<li>
Eventual additional information you've provided in this form.
</li>
<li>
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.
</li>
</ul>
<vscode-form-container id="crash-report-form">
<vscode-form-group variant="vertical">
<vscode-label>Crash ID</vscode-label>
<vscode-textfield value="<%= crashUID %>" readonly></vscode-textfield>
<vscode-form-helper>You can send this ID to the IAP team when discussing an issue with them.</vscode-form-helper>
<vscode-form-helper>You can send this ID to the OdooLS team when discussing an issue with them.</vscode-form-helper>
</vscode-form-group>
<vscode-form-group variant="vertical">
<vscode-label for="crash-info-field">
Expand Down
11 changes: 7 additions & 4 deletions client/views/crash_report/crashReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ 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;
this._error = error;
this.UID = uid;
this._command = command;
this._debugFile = debugFile;
this._recentMessages = recentMessages;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated?


// 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)
Expand All @@ -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();
}
Expand All @@ -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));
}

/**
Expand Down Expand Up @@ -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",
Expand All @@ -166,6 +168,7 @@ export class CrashReportWebView {
python_version: version,
configuration: configString,
command: this._command,
recent_messages: this._recentMessages? this._recentMessages : "",
}
});
this.dispose();
Expand Down