/vscode-make-executable-if-script

A VSCode extension that automatically makes files executable when they start with a hashbang (#!).

Primary LanguageTypeScript

Make Executable If Script

Warning

This extension is currently a unfinished work in progress, and mostly written by AI. The idea was simply to get a very quick intro to VSCode extension development, with a goal of actually diving deeper to understand things properly at a later date.

A VSCode extension that automatically makes files executable when they start with a hashbang (#!).

Features

  • Automatically marks files as executable when saved if they start with #! (enabled by default).
  • Manual command to mark current file as executable if it has a hashbang.
  • Shows permission changes in a non-intrusive way.
  • Works with any script type (bash, python, perl, etc.)

Usage

Automatic Mode (Default)

By default, any file you save that starts with #! will automatically be made executable if it isn't already. For example:

#!/bin/bash
echo "Hello World"

Save the file, and it will automatically be made executable.

Manual Mode

You can also manually mark a file as executable:

  1. Open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
  2. Type "Make Executable If Script"
  3. Press Enter

The command will only make the file executable if it starts with #!.

Extension Settings

This extension contributes the following settings:

  • make-executable-if-script.autoMarkOnSave: Enable/disable automatic marking of files as executable on save (default: true)
  • make-executable-if-script.silent: Suppress notifications when files are made executable (default: false)

Platform Support

Unix-like Systems (macOS, Linux)

  • Makes files executable using chmod +x
  • Preserves existing file extension
  • Works with all script types