File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -260,6 +260,12 @@ export async function createClient(
260260 }
261261 result . push ( primary ) ;
262262 }
263+
264+ result . sort ( ( a , b ) => {
265+ const priorityA = getActionPriority ( a ) ;
266+ const priorityB = getActionPriority ( b ) ;
267+ return priorityA - priorityB ;
268+ } ) ;
263269 return result ;
264270 } ;
265271 return client
@@ -413,3 +419,12 @@ function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownStri
413419 result . isTrusted = true ;
414420 return result ;
415421}
422+
423+ const getActionPriority = ( action : vscode . CodeAction | vscode . Command ) : number => {
424+ // rust-analyzer diagnostic > rust-analyzer assist > rustc diagnostic > other
425+ if ( action . edit && action . edit . size > 0 ) return 2 ;
426+ const command = action . command ?. command ;
427+ if ( command === "rust-analyzer.resolveCodeAction" ) return 0 ;
428+ if ( command === "rust-analyzer.applyActionGroup" ) return 1 ;
429+ return 3 ;
430+ } ;
You can’t perform that action at this time.
0 commit comments