In a big project, real-time AI assist usually uses the current buffer or file as a context, which is not enough information to make a perfect suggestion. But they often give good enough partially correct predictions. Once you manually provide some details, they can get the rest right.
disclaimer: the completion setup is for vsnip but I think you can easily adapt it to other completion engines.
so the nice thing about my setup is that it only sets up html suggestion for specific projects using the power of excr files (.nvim.lua in this case). (it also works for CSS suggestions if you are into css-in-rust stuff)
First you want to have this in your lua config to enable projet-specific config files.
vim.o.exrc = true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
def quick_sort_find_n_th_largest(numbers: List[float], n: int) -> float: | |
pivot = numbers[0] | |
left = [] | |
right = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassName: | |
_instance = None | |
def __init__(self, arg1, arg2, arg3): | |
if ClassName._instance is None: | |
# do initialization here | |
ClassName._instance = self | |
def __new__(cls, **kwargs): | |
if cls._instance is None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import select | |
import termios | |
import tty | |
import pty | |
from subprocess import Popen | |
command = 'python' | |
# command = 'docker run -it --rm centos /bin/bash'.split() |