Added the command of overwriting interface files
Added the command of overwriting interface files
I need to update the .resi interface file from time to time while using the plugin. However, in each operation, I had to delete the old file before using the plug-in command to create a new .resi interface file, which was really uncomfortable. Therefore, I have the following improvement requirements.
- When a
.resifile exists, the command can override the contents of the original file. - If the file does not exist, the
.resifile is created, and the behavior is the same as that of creating an interface file.
In terms of implementation
I looked at the source code, and adding a command doesn't add much complexity.
Other things
I am very sorry that I have not learned the TS code, so I cannot submit the relevant code implementation. Thank you very much for your earnest and dedication.
The solution is not as trivial as I thought it would be. When there is an interface file it will affect what is inside the compiled interface file (.cmi) from which the .resi gets constructed. So an overwrite command would involve:
- Deleting the
.resifile - Starting a new build
- If the build is successful, there will be a new
.cmi - Now the updated
.resican be generated
Or is there a better way? @cristianoc
I'd forgotten the command starts from the .cmi file. As all the other commands use .cmt.
Since one can delete a file from within the editor, it's unlikely that a command will be created to do all theses operations at once when one can just use two commands within the editor, to delete the interface file, and create a new one.
Another idea.
The server has a cache for the implementation file .res. We can add a command to analysis CLI to extract the signature of each structure_item. Similar to what is done for Code Lens.
In this case, we don't need to delete .resi