Skip to content

Commit

Permalink
Fixes an issue with how snippets are expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleroy committed Jul 19, 2024
1 parent 0b009aa commit 3fe4c68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ async def add_configuration(debugger: Debugger):

def format_snippet(snippet: dict[str, Any]):
body = snippet.get('body', {})
for (key, value) in snippet.items():
if isinstance(value, str) and value.startswith('^"') and value.endswith('"'):


for (key, value) in body.items():
# ^ seems to say the value is a json string already
# https://github.com/microsoft/vscode-json-languageservice/blob/386ce45491130c49e5e59e79ef209cd5de7a2057/src/services/jsonCompletion.ts#L788
if isinstance(value, str) and value.startswith('^'):
body[key] = value[2:-1]

content = json.dumps(body, indent="\t")
Expand Down

0 comments on commit 3fe4c68

Please sign in to comment.