File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
lldb/tools/lldb-dap/src-ts/commands Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,16 @@ export async function pickProcess(
2626 processes . sort ( ( a , b ) => b . start - a . start ) ;
2727 // Filter by program if requested
2828 if ( typeof configuration ?. program === "string" ) {
29- processes = processes . filter (
30- ( proc ) => proc . command === configuration . program ,
31- ) ;
29+ const program = configuration . program ;
30+ const programBaseName = path . basename ( program ) ;
31+ processes = processes
32+ . filter ( ( proc ) => path . basename ( proc . command ) === programBaseName )
33+ . sort ( ( a , b ) => {
34+ // Bring exact command matches to the top
35+ const aIsExactMatch = a . command === program ? 1 : 0 ;
36+ const bIsExactMatch = b . command === program ? 1 : 0 ;
37+ return bIsExactMatch - aIsExactMatch ;
38+ } ) ;
3239 // Show a better message if all processes were filtered out
3340 if ( processes . length === 0 ) {
3441 return [
You can’t perform that action at this time.
0 commit comments