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 issue with incorrectly finding and triggering certain remappings #2890

Merged
merged 1 commit into from
Jul 25, 2018
Merged

Fix issue with incorrectly finding and triggering certain remappings #2890

merged 1 commit into from
Jul 25, 2018

Conversation

xconverge
Copy link
Member

fixes #2888

@xconverge xconverge merged commit b83139c into VSCodeVim:master Jul 25, 2018
@xconverge xconverge deleted the fix-remapping-quirk-with-map branch July 25, 2018 02:39
@wcauchois
Copy link

Thank you @xconverge!

@jpoon
Copy link
Member

jpoon commented Jul 25, 2018

Err. sorry. I don't get this change. ELI5?

@xconverge
Copy link
Member Author

xconverge commented Jul 25, 2018

@jpoon

Running this:

var remappings: { [key: string]: number } = {};

remappings["test"] = 4;

if(remappings["constructor"]){
	console.log("matched constructor");
}

if(remappings["test"]){
	console.log("matched matched test");
}

if(remappings["test123"]){
	console.log("matched matched test123");
}

The output is:

console: matched constructor
console: matched matched test

Any function name in the prototype of the object counts as a key in the map. There are ~10-20 functions in here and if anyone is writing javascript or typescript they would run into this problem a lot with our remapping

The fix here was to remove the prototype and have a plain map.

This was super enlightening to me and does not make sense to me coming from C++

@jpoon
Copy link
Member

jpoon commented Jul 25, 2018

Lol. Good catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'r' in insert mode not entered when typed quickly
3 participants