alexanderflink / nova-tabnine

TabNine extension for Nova
17 stars 4 forks source link

Update for new M1 version of tabnine and optimized memory consumption #6

Closed berkus closed 2 years ago

berkus commented 3 years ago

Hi, TabNine has been recently updated to reduce memory consumption by using a shared process and also added a native M1 version.

Could this plugin be updated to use the latest version?

alexanderflink commented 3 years ago

Hi! Yes, I will get on it asap!

berkus commented 3 years ago

🙇🏻‍♂️

alexanderflink commented 3 years ago

Actually, TabNine should be updating automatically so it looks like it's already using the new shared process. Seems like that's the case when looking at the processes it starts. Before, each TabNine instance would take up a large amount of memory.

I did take the time to change the TabNine install directory to the Nova global extension directory. That should fix some crashes I was experiencing when TabNine was updating.

Please open another issue if there's something I missed!

image

berkus commented 3 years ago

Hmm, could it be failing to update for me for some reason? I will investigate this evening, last time I checked it wasn't updated for me.

alexanderflink commented 3 years ago

Just read up on TabNine docs, you are correct! It seems that on M1 macs TabNine deep local does not work using Rosetta. I'll make sure to update this. https://github.com/codota/TabNine/blob/master/HowToWriteAClient.md#about-apple-m1-processor-support

alexanderflink commented 3 years ago

@berkus I finally had some time to sit down and research this. However, since there's no official api in Nova to detect the architecture, I think it has to be done in a shell script. As I don't own a M1 Mac, I can't test it properly. I think the idea would simply be to add some code to the getVersion function of this extension to detect if running on an M1 Mac. Also the dl_binaries.sh file has to be updated to include the aarch64-apple-darwin target, as seen here.

If you're up for it i'd gladly accept a PR for this. :)

berkus commented 3 years ago

@alexanderflink hey, does it use the version of tabnine from ~/.tabnine automatically? Which version does it choose? Currently I have three versions installed by three plugins, but the latest version is definitely aarch64.

alexanderflink commented 3 years ago

@berkus It installs TabNine to /Users/user/Library/Application Support/Nova/Extensions/alexanderflink.tabnine. If there is an .active file it will use that, otherwise it will pick the latest version in the folder. However, I think aarch64 needs to be added to the install script (dl_binaries.sh). There is a pretty good guide here on how it works.

alexanderflink commented 3 years ago

The extension is broken right now though, due to #7 😬

berkus commented 3 years ago

If you could add detecting an existing correct version in ~/.tabnine and using it that would be awesome :)

alexanderflink commented 3 years ago

Hmm, I'm a bit hesitant to look for a ~/.tabnine installation since it will automatically update TabNine whenever running the process and that could potentially break it for other applications. I will try to get a hold of an M1 mac for testing, but I don't expect I'll have time to solve this any time soon. 🙁 Any help is greatly appreciated!

berkus commented 3 years ago

Hmm, I think ~/.tabnine can hold multiple versions at once, so it will not be automatically replaced.

❯ ls ~/.tabnine/
3.3.105  3.3.108  3.3.112

❯ ls ~/.tabnine/3.3.112/aarch64-apple-darwin/
bundle.lock  TabNine  TabNine-deep-cloud  TabNine-deep-local  WD-TabNine
ghost commented 3 years ago

Thank you for your extension. Rebuild for Mac M1. https://www.mediafire.com/file/a91xmm1gegdwxer/tabnine.novaextension.zip/file

alexanderflink commented 2 years ago

Hey everyone! I have just gotten an M1 mac. I've updated the extension to check for, and download the correct TabNine version. You may have to restart the extension after updating. Please open a new issue if you see any problems. Cheers!