mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 12:43:36 +00:00
fix incorrect committed rust and run prettier
This commit is contained in:
parent
cfa15d49aa
commit
de5e3cf745
@ -145,26 +145,28 @@ pub(crate) fn view_memory_layout(
|
||||
}
|
||||
}
|
||||
|
||||
ty.layout(db).map(|layout| {
|
||||
let item_name = match def {
|
||||
Definition::Local(l) => l.name(db).as_str().unwrap().to_owned(),
|
||||
_ => "[ROOT]".to_owned(),
|
||||
};
|
||||
ty.layout(db)
|
||||
.map(|layout| {
|
||||
let item_name = match def {
|
||||
Definition::Local(l) => l.name(db).as_str().unwrap().to_owned(),
|
||||
_ => "[ROOT]".to_owned(),
|
||||
};
|
||||
|
||||
let typename = ty.display(db).to_string();
|
||||
let typename = ty.display(db).to_string();
|
||||
|
||||
let mut nodes = vec![MemoryLayoutNode {
|
||||
item_name,
|
||||
typename: typename.clone(),
|
||||
size: layout.size(),
|
||||
offset: 0,
|
||||
alignment: layout.align(),
|
||||
parent_idx: -1,
|
||||
children_start: -1,
|
||||
children_len: 0,
|
||||
}];
|
||||
read_layout(&mut nodes, db, &ty, &layout, 0);
|
||||
let mut nodes = vec![MemoryLayoutNode {
|
||||
item_name,
|
||||
typename: typename.clone(),
|
||||
size: layout.size(),
|
||||
offset: 0,
|
||||
alignment: layout.align(),
|
||||
parent_idx: -1,
|
||||
children_start: -1,
|
||||
children_len: 0,
|
||||
}];
|
||||
read_layout(&mut nodes, db, &ty, &layout, 0);
|
||||
|
||||
RecursiveMemoryLayout { nodes }
|
||||
})
|
||||
RecursiveMemoryLayout { nodes }
|
||||
})
|
||||
.ok()
|
||||
}
|
||||
|
@ -1132,27 +1132,24 @@ export function linkToCommand(_: Ctx): Cmd {
|
||||
|
||||
export function viewMemoryLayout(ctx: CtxInit): Cmd {
|
||||
return async () => {
|
||||
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (!editor) return "";
|
||||
const client = ctx.client;
|
||||
|
||||
const position = editor.selection.active;
|
||||
const expanded = await client.sendRequest(ra.viewRecursiveMemoryLayout, {
|
||||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(
|
||||
editor.document
|
||||
),
|
||||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document),
|
||||
position,
|
||||
});
|
||||
|
||||
// if (expanded == null) return "Not available";
|
||||
|
||||
|
||||
const document = vscode.window.createWebviewPanel(
|
||||
"memory_layout",
|
||||
"[Memory Layout]",
|
||||
vscode.ViewColumn.Two,
|
||||
{ enableScripts: true, });
|
||||
{ enableScripts: true }
|
||||
);
|
||||
|
||||
document.webview.html = `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
@ -1407,7 +1404,7 @@ locate()
|
||||
|
||||
})()
|
||||
</script>
|
||||
</html>`
|
||||
</html>`;
|
||||
|
||||
ctx.pushExtCleanup(document);
|
||||
};
|
||||
|
@ -70,7 +70,7 @@ export const viewItemTree = new lc.RequestType<ViewItemTreeParams, string, void>
|
||||
|
||||
export type AnalyzerStatusParams = { textDocument?: lc.TextDocumentIdentifier };
|
||||
|
||||
export interface FetchDependencyListParams { }
|
||||
export interface FetchDependencyListParams {}
|
||||
|
||||
export interface FetchDependencyListResult {
|
||||
crates: {
|
||||
@ -86,7 +86,7 @@ export const fetchDependencyList = new lc.RequestType<
|
||||
void
|
||||
>("rust-analyzer/fetchDependencyList");
|
||||
|
||||
export interface FetchDependencyGraphParams { }
|
||||
export interface FetchDependencyGraphParams {}
|
||||
|
||||
export interface FetchDependencyGraphResult {
|
||||
crates: {
|
||||
@ -150,9 +150,11 @@ export const serverStatus = new lc.NotificationType<ServerStatusParams>(
|
||||
"experimental/serverStatus"
|
||||
);
|
||||
export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>("experimental/ssr");
|
||||
export const viewRecursiveMemoryLayout = new lc.RequestType<ViewRecursiveMemoryLayoutParams, RecursiveMemoryLayout | null, void>(
|
||||
"rust-analyzer/viewRecursiveMemoryLayout"
|
||||
);
|
||||
export const viewRecursiveMemoryLayout = new lc.RequestType<
|
||||
ViewRecursiveMemoryLayoutParams,
|
||||
RecursiveMemoryLayout | null,
|
||||
void
|
||||
>("rust-analyzer/viewRecursiveMemoryLayout");
|
||||
|
||||
export type JoinLinesParams = {
|
||||
textDocument: lc.TextDocumentIdentifier;
|
||||
@ -219,4 +221,4 @@ export type RecursiveMemoryLayout = {
|
||||
name: string;
|
||||
expansion: string;
|
||||
nodes: RecursiveMemoryLayoutNode[];
|
||||
};
|
||||
};
|
||||
|
@ -24,11 +24,11 @@ export async function activate(
|
||||
vscode.window
|
||||
.showWarningMessage(
|
||||
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Rust (rust-lang.rust) ` +
|
||||
"plugins enabled. These are known to conflict and cause various functions of " +
|
||||
"both plugins to not work correctly. You should disable one of them.",
|
||||
"plugins enabled. These are known to conflict and cause various functions of " +
|
||||
"both plugins to not work correctly. You should disable one of them.",
|
||||
"Got it"
|
||||
)
|
||||
.then(() => { }, console.error);
|
||||
.then(() => {}, console.error);
|
||||
}
|
||||
|
||||
const ctx = new Ctx(context, createCommands(), fetchWorkspace());
|
||||
@ -144,7 +144,7 @@ function createCommands(): Record<string, CommandFactory> {
|
||||
health: "stopped",
|
||||
});
|
||||
},
|
||||
disabled: (_) => async () => { },
|
||||
disabled: (_) => async () => {},
|
||||
},
|
||||
|
||||
analyzerStatus: { enabled: commands.analyzerStatus },
|
||||
|
Loading…
Reference in New Issue
Block a user