Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-completion #6

Open
christophe-gouel opened this issue Aug 30, 2023 · 10 comments
Open

auto-completion #6

christophe-gouel opened this issue Aug 30, 2023 · 10 comments

Comments

@christophe-gouel
Copy link
Contributor

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 have imported the full list of GAMS commands (the people from GAMS gave me the location).
  • Enabled a standard completion-at-point using this list.
  • And for those who wants to use company, I have defined the proper backends. But this is optional, it can works with other completion frameworks since it relies on the emacs standard completion functions.

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

Are you interested by a PR?

@christophe-gouel
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Owner

Thank you.

I forgot to update the setting for MELPA.

@ShiroTakeda
Copy link
Owner

I updated GAMS mode distributed on MELPA.

@christophe-gouel
Copy link
Contributor Author

christophe-gouel commented Oct 8, 2023

It works perfectly now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants