Skip to content

Commit

Permalink
prevent chpl-shim from overwriting files when unnecessary
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Jun 12, 2024
1 parent a1cde47 commit cadc27f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/chpl-language-server/src/chpl-shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ def run_toplevel():
for key, value in from_file.items():
commands[key].append(value)

with open(".cls-commands.json", "w") as f:
json.dump(commands, f)

# Skip if we would overwrite an existing file with empty commands
skip_cls = os.path.exists(".cls-commands.json") and len(commands.keys()) == 0
if not skip_cls:
with open(".cls-commands.json", "w") as f:
json.dump(commands, f)


def run_chpl_shim():
Expand Down

0 comments on commit cadc27f

Please sign in to comment.