Skip to content

Commit

Permalink
Use open_project_or_workspace for Debugger: Example Projects command
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleroy committed Oct 6, 2023
1 parent 0c2b77a commit 7921cc9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions modules/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import os

import json
import subprocess
import webbrowser

from .import ui
Expand All @@ -31,13 +30,13 @@ def item(project: str):

types = set()

with open(file) as f:
with open(file) as f:
data = sublime.decode_value(f.read())
for configuration in data['debugger_configurations']:
types.add(configuration['type'])

types = ', '.join(types)
return ui.InputListItem(lambda: subprocess.Popen(['subl', '--project', file]), f'{name} \t{types}')
return ui.InputListItem(lambda: sublime.active_window().run_command('open_project_or_workspace', { 'file': file }), f'{name} \t{types}')

await ui.InputList('Example Projects') [
list(map(item, examples.projects))
Expand Down Expand Up @@ -79,8 +78,8 @@ def snippet_item(snippet: Any):

request = snippet.get('body', {}).get('request', '??')
snippet_item = ui.InputListItem (
lambda: debugger.project.insert_snippet(content),
snippet.get('label', 'label'),
lambda: debugger.project.insert_snippet(content),
snippet.get('label', 'label'),
details=request,
preview=lambda: sublime.Html(f'<code>{ui.html_escape_multi_line(content)}</code>')
)
Expand Down Expand Up @@ -110,7 +109,7 @@ def adapter_list_item_not_installed(adapter: dap.AdapterConfiguration) -> ui.Inp
name,
details=f'<a href="{adapter.docs}">documentation</a>'
)


if adapter.installed_version:
installed.append(adapter_list_item_installed(adapter))
Expand Down Expand Up @@ -207,7 +206,6 @@ def input_list():
]

def error_item(error: str):
core.error(error)
return ui.InputListItemChecked(
lambda: ...,
installed_version != None,
Expand Down

0 comments on commit 7921cc9

Please sign in to comment.