Local path completion in python functions

Hi Doom Emacs!

Suppose I have a local csv file that is located in /home/my_data/data.csv. Suppose I also have some code that looks like this:

import pandas as pd

df = pd.read_csv(PATH_TO_MY_DATA)

I was curious if it were possible to have local paths be tab completed in a function like read_csv() (or any function really)?

In other words, once I start writing pd.read_csv('/home/my_' and then hit tab, is it possible to have a window popup or something that will tab complete to pd.read_csv('/home/my_data/'?

Thanks in advance for your help!

System information


Loading data dump...

Actually I do have have this kind of completion, but i don’t remember if I had to configure it.

But there is a good old keybinding if you know you want a file: “C-x C-f” in insert mode which invoke company-files Note: this works on vanilla vim too

@VincentRavera with the example that I provide in the initial post, C-x C-f gives me a message saying Cannot complete at point. Any idea what’s going on there?

It happend to me only when the file doesn’t exist i.e.:

  1. insert mode
  2. type: /adjzdhajzd
  3. While still in insert mode C-x C-f Cannot complete at point

(At least this is company output, meaning you have it enabled in .doom.d/init.el)

You could also try the following

  1. on a new buffer
  2. insert mode
  3. type: /
  4. While still in insert mode: M-x company-files

Should pop a drop down like this: 20250130_150606

Anything else is beyond me.