microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
195 stars 60 forks source link

fix comment toggling #453

Open mcandre opened 1 year ago

mcandre commented 1 year ago

When I toggle on comments in makefile tasks with editor.action.commentLine, then I want the # to appear at the very start of the line, not nested after a tab.

make, unlike other common scripting languages, treats /^\t#...$/ as an actual command to send to the shell interpreter. Which produces ugly traces on UNIX terminals, and syntax errors on Command Prompt terminals.

When enabling comments for commands in a makefile rule, please stop the usual indentation and whitespace behavior, and just insert #\t at the very start of the line. When disabling comments, drop the # prefix from the start of the line.

Examples

Bad:

all:
    # @rustup component add clippy

Good:

all:
#   @rustup component add clippy

Commenting other regions of a makefile are probably fine with the existing behavior.

gcampbell-msft commented 1 year ago

@mcandre Thank you for the post and the suggestion! We will make sure to take note of this as we investigate supporting things like Intellisense and colorization in makefiles.