Closed daUnknownCoder closed 1 week ago
Hey there!
Python and many of the other languages you're trying to add are already supported by default..
When adding custom languages, it's important that you add a separate table for each language, each with its own regex, filetypes, and extensions, rather than put it all in one single table.
Currently it looks like you're trying to use a single catch all regex, for all the different potential filetypes.
Just follow the format of the built in supported languages, or search GitHub to see how others have used the the custom languages option.
cool, adding the custom
table proved unnecessary ig
ok so this doesnt work for python
, tested for js
, ts
, lua
but it doesnt work for python idk why
my config:
{
"piersolenski/telescope-import.nvim",
lazy = true,
keys = { { "fi", "<cmd>Telescope import<CR>", desc = "Import Modules [Telescope]" } },
cmd = "Telescope import",
},
import = {
insert_at_top = true,
},
telescope.load_extension("import")
From your example it looks like you're not using standard Python, and you have some form of type annotations. Can you share what your import statements look like in the project you're trying to use it in? What happens when you run <cmd>Telescope import<cr>
?
i just do nvim <some-file>.py
this is the code in the file:
from abc import ABC, abstractmethod
class Shapes(ABC):
@abstractmethod
def area(self):
pass
class Circle(Shapes):
def __init__(self, radius):
self.radius = radius
def area(self):
return (22 / 7) * self.radius * self.radius
class Rectangle(Shapes):
def __init__(self, width, length):
self.width = width
self.length = length
# def area(self):
# return (22 / 7) * self.length * self.width
rectangleobj = Rectangle(500, 100)
print(f"Rectangle Area: {rectangleobj.area()}")
circleobj = Circle(5)
print(f"Circle Area: {circleobj.area()}")
<cmd>Telescope import<cr>
looks like this
for a random lua
code, it looks like this:
for a random
js
code, it looks like this:
fi
[Telescope import
] ⬇️config
:other config, where![image](https://github.com/piersolenski/telescope-import.nvim/assets/84800625/e4502fe1-ac3d-4338-859e-db2dd57eece6)
extensions
table does not havepython
⬇️other config, where
⬇️
[Note that typing ![image](https://github.com/piersolenski/telescope-import.nvim/assets/84800625/9216f3d1-5dc6-4314-ae57-fe56ddc4dae9)
extensions
table does not havepython
,filetypes
table also does not have python ⬇️from <some module> ...
andimport <some module>
does not give me results] ⬇️[Same for
lua
with same config]