BigBahss / vscode-cmantic

C/C++ code generation for VS Code: Generate Definitions, Getters, Setters, and much more.
https://bigbahss.github.io/vscode-cmantic/
MIT License
84 stars 9 forks source link

[Bug] Does not generate matching functions correctly #57

Open Ataraxia-Mechanica opened 1 year ago

Ataraxia-Mechanica commented 1 year ago

rng.hpp, in /include/ folder:
1

2

File generated in /src/ folder:
3

(This issue also occurs when choosing other definition-generating commands when the files are in different folders)

Ataraxia-Mechanica commented 1 year ago

Nevermind just tried to generate in the same folder it also fails. Can't figure out the reason.

sedmicha commented 1 year ago

Same issue. This was working correctly for me until maybe 1-2 months ago, but now it's doing this.

geiseri commented 1 year ago

This is strange. The behavior happens when I access a remote workspace from my Mac, but NOT when I connect from Windows. Could it be confused by a path internally?

sedmicha commented 1 year ago

Just to add more information, this is happening to me on a local machine running Ubuntu 22.04

Ataraxia-Mechanica commented 1 year ago

For me it was happening on a Windows 10 local machine

geiseri commented 1 year ago

Okay, this is nuts. Today it works just fine with absolutely no changes to my workspace or versions. I wonder if it's actually some sort of state issue.

felixbardy commented 1 year ago

This behaviour just appeared on my Linux machine, after working correctly just seconds ago.

syborg64 commented 9 months ago

CSymbol.ts:835-841

const nameEndIndex =
        this.document.offsetAt(this.selectionRange.end) - this.document.offsetAt(declarationStart);
const paramStartIndex = maskedDeclaration.indexOf('(', nameEndIndex);
const paramEndIndex = maskedDeclaration.indexOf(')', nameEndIndex);
if (paramStartIndex === -1 || paramEndIndex === -1) {
    return ''; //dumb early return
}

I will be trying to fix this. I have no expectation of this future PR being merged.

Ataraxia-Mechanica commented 8 months ago

https://github.com/microsoft/vscode-cpptools/issues/1162 CPPtools can move functions to the corresponding cpp file by right clicking a function -> refactor now. Can't do batching though.