spmeesseman / vscode-taskexplorer

Run and Manage Tasks for Visual Studio Code
Other
141 stars 30 forks source link

Bug Report: Makefile target detection is malfunctioning #82

Closed Maxwell-Lyu closed 4 years ago

Maxwell-Lyu commented 4 years ago

Sidebar showing false targets

image

The Makefile that triggers the bug:

OBJS = $(CFILES:.c=.o)
clean:
    rm -f $(OBJS) $(OBJS:.o=.d)
    rm -f *~

The line that is treated as a target:

    OBJS = $(CFILES:.c=.o)
    rm -f $(OBJS) $(OBJS:.o=.d)

Possible cause

In file taskProviderMake.ts, line 167:

const line: string = contents.substring(idx, eol).trim();

the .trim() trims off '\t' and ' ' from both ends of the line, making the following condition:

if (line.length > 0 && !line.startsWith("\t") && !line.startsWith(" ")

not working

Suggestion: in taskProviderMake.ts

I'm still working on it. :(

Filter for variable definition:

Add condition to line 182: tgtName.indexOf("=") === -1

            if (tgtName.indexOf("/") === -1 && tgtName.indexOf("=") === -1 && tgtName.indexOf("\\") === -1

Remove .trim() from line 167, then the 'if' will work

if (line.length > 0 && !line.startsWith("\t") && !line.startsWith(" ")
Maxwell-Lyu commented 4 years ago

The sugestions are tried locally, by modifying taskProviderMake.js under .vscode/extensions/spmeesseman.vscode-taskexplorer-1.24.0/out The same Makefile is now correctly parsed image

spmeesseman commented 4 years ago

:tada: This issue has been resolved in version 1.24.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: