Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interface handling to support renaming across interface files #87

Open
mrvicadai opened this issue Aug 16, 2018 · 6 comments
Open
Labels
bug Something isn't working rename

Comments

@mrvicadai
Copy link

Hi there, I'm using reason-langauge-server along with vscode and so far it's been a solid experience. When using symbol renaming (F2), it seems to only work in the scope of a single file / module. It would be so nice if renaming could be propagated to the entire project.

I know this feature isn't easy, so just want to put in a request to keep on the backlog : )

@jaredly
Copy link
Owner

jaredly commented Aug 16, 2018

Could you detail the situations where it doesn't work? This feature is supported, but might have some bugs :)

@mrvicadai
Copy link
Author

mrvicadai commented Aug 16, 2018

@jaredly Okay found it! Here's a quick SSCCE

// foo.re

let ask = (question: string) => Js.log(question);
let inquire = (question: string) => Js.log(inquire);
// foo.rei
// do not expose "ask" function.
let inquire: string => ();
// bar.re

Foo.ask("Howdy");
//  ^ rename the "ask" token

Now when I try to rename the ask symbol in foo.re (the source), the original method in foo.re is indeed changed; however the ask reference in bar.re is not changed.

Also, when I remove the .rei file, the rename feature works -- so I'm guessing it's a bug when taking the interface definition into consideration.

@mrvicadai mrvicadai changed the title [feature request] Support symbol renaming across project Support symbol renaming across project Aug 16, 2018
@jaredly
Copy link
Owner

jaredly commented Aug 16, 2018

hmmm if foo.rei doesn't expose ask, then bar.re shouldn't be able to access it at all 🤔 does that code even compile?

@mrvicadai
Copy link
Author

mrvicadai commented Aug 16, 2018

My bad, I've got it wrong for which module the .rei file is created for. Here's the updated example:

/* foo.re */

let ask = (question: string) => Js.log(question);
let inquire = (question: string) => Js.log(question);
/* bar.re */

let greet1 = () => Foo.ask("Howdy");
/*  ^ rename the "ask" symbol */

let greet2 = () => Foo.inquire("Howdy");
/* bar.rei */
/* do not expose "greet1" function. */
let greet2: () => ();

@jaredly
Copy link
Owner

jaredly commented Aug 17, 2018

ah yes, I definitely need better support for interfaces

@jaredly jaredly changed the title Support symbol renaming across project Fix interface handling to support interface files Aug 26, 2018
@jaredly jaredly changed the title Fix interface handling to support interface files Fix interface handling to support renaming across interface files Aug 26, 2018
@jaredly
Copy link
Owner

jaredly commented Aug 30, 2018

Partially fixed -- there's still a bug if you have bucklescript's namespacing turned on...

@jaredly jaredly added rename bug Something isn't working labels Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rename
Projects
None yet
Development

No branches or pull requests

2 participants