ShiroTakeda / gams-mode

GAMS mode for Emacs
http://shirotakeda.org/en/gams/gams-mode/
12 stars 4 forks source link

auto-completion #6

Open christophe-gouel opened 10 months ago

christophe-gouel commented 10 months ago

Hi,

I would like for gams-mode to have a standard emacs auto-completion. I am aware of your gams-ac package, but the auto-complete package is de facto no longer maintained and company-mode is the new standard.

I have started something that seems to work:

I barely know elisp, so I did it with a big help from ChatGPT.

Are you interested by a PR?

christophe-gouel commented 10 months ago

Here is a GIF of the auto-completion with company-mode: company-gams

As you can see, it takes care of auto-completion of filenames that was in your TODO list.

And here is another using the basic auto-completion functions of emacs: capf-gams

ShiroTakeda commented 10 months ago

Thank you.

I am interested in the code for supporting company-mode , so please send me a pull request.

However, it is generally preferable to have the code for company-mode support in a separate package, rather than directly in gams-mode, which is why I have the code for auto-completion mode in a separate package (gams-ac package).

Therefore, it is better to provide the code for company-mode support in a separate repository on github. Any thoughts on this point? I can create a repository for this purpose.

christophe-gouel commented 10 months ago

It is not necessarily the case that a company-specific package is better. This is what I thought too at the beginning, but I changed my mind. The way I implemented it is inspired from ess, which keeps all the code for auto-complete and company in the package. Then it is transparent for the user: if you use company, it works automatically in ess, and the same for auto-complete. No need to install another package.

But the main reason for not creating a company-gams package is that there is only one line of code related to company in what I have done.

The key idea is that I have not implemented a GAMS auto-completion with company, I have implemented a GAMS auto-completion using the built-in completion-at-point function of emacs. It means that the completion works even if you don't use any completion package. Once you have completion-at-point working, there is nothing to do for company: company relies on completion-at-point for providing completion.

I don't know how auto-complete works, but it is likely that what I have done could also be used with auto-complete without gams-ac.

I will send you the PR this week.

christophe-gouel commented 9 months ago

Thanks for merging the PR.

From this, are you interested in my suggestion of replacing the existing list of strings used for font-lock by the complete lists present in the txt files to have a more complete font-lock?

ShiroTakeda commented 9 months ago

After merging your PR, I have modified gams-mode.el slightly. In addition, I moved script file for creating gams_commands.txt to command_files directory. If you find a problem in the program, please let me know.

I am interested in expanding the scope of the font-lock feature.

christophe-gouel commented 9 months ago

In addition, I moved script file for creating gams_commands.txt to command_files directory.

Good move.

I have seen that you have also added the MPSGE commands, which is good too. I wanted to do it next.

I am interested in expanding the scope of the font-lock feature.

When I will have time, I will look a bit at this. Likely over the coming weeks.

Thanks for all your work.

christophe-gouel commented 9 months ago

I have just tested the package released on MELPA and the auto-completion does not work because the package does not include the gams_commands.txt file.

ShiroTakeda commented 9 months ago

Thank you.

I forgot to update the setting for MELPA.

ShiroTakeda commented 9 months ago

I updated GAMS mode distributed on MELPA.

christophe-gouel commented 9 months ago

It works perfectly now. Thanks.