VSCode New Files
The company I work for have a repository for one of our products which already contains both InterSystems and non-InterSystems source code. I'm in the process of trying to migrate us over to using VSCode to edit the InterSystems source but am stuck on some issues surrounding the files on disk and the routines in the IRIS instance.
The folder structure inside the repo is \appname\src\database. Directly underneath the database folder is all of our InterSystems source code. If I add a new routine to the root of the database folder called ROUTINEA.int, the created routine ends up being prefixed with "src.database."
In VS Code it looks like this:
.png)
In IRIS Studio it looks like this:
.png)
I don't want new routines to live in a package within IRIS called src.database.
My workspace file looks like this:
{
"folders": [
{
"path": "."
}
],
"settings": {
"objectscript.conn": {
"server": "iris",
"ns": "{namespace}",
"active": true
},
"objectscript.export": {
"folder": "src/database",
"addCategory": false,
"map": {},
"atelier": true,
"generated": false,
"filter": "",
"exactFilter": "",
"category": "*",
"noStorage": false,
"dontExportIfNoChanges": false,
"maxConcurrentConnections": 0,
"mapped": true
}
}
}
I've tried all the things I can think of to alter the workspace settings but am totally stuck on how to make VSCode know that the database folder is the root folder. I've even had a look through the github repos to see if I can track down what is going on. I should also add that I don't want to move the workspace file to within the database folder, whilst it would resolve this issue, it introduces another issue in that the developer can't select the database folder to import and compile all contents. Has anyone else tackled this issue?
Any help would be much appreciated.
Comments
@Mathew Rimmington
Based on your description, I think that your setting for "objectscript.export.folder" should be "appname/src/database" instead of "src/database".
Hi @Brett Saviano, just tried it but made no difference sadly. New routines are still created in package src.database.
I just created a code-workspace file using your example above and I couldn't reproduce this is it possible that there's a .vscode/settings.json inside the "." folder that contains different objectscript.export settings? If so, those will take precedence. Folder-specific settings take precedence over workspace-specific settings, and workspace-specific take precdence over user-specific.
In the repository root there is a .vscode/settings.json file but it doesn't override any export settings. It looks like this:
As an experiment, I did try switching the folder structure to appname/database/src. I also changed the objectscript.export.folder setting to match the new structure. This does resolve the issue.
Is there some hardcoding of the "src" folder perhaps in the extension?
The trouble is, I can't leave the folder structure like this.
I'm guessing that Brett is testing on a non-Windows platform. By replicating Mathew's setup on Windows I can reproduce the issue.
Mathew, please try using backslash in the "folder" property of your "objectscript.export" settings object:
"folder": "src\\database",
Hi @John Murray, thanks so much for this. I can confirm that this fixes the issue.
It's interesting to note it must be double backslash. I had mine as "src/database" as well and that does not work for new files but works for the "goto to definition" feature. I'm guessing some of these are normalised and some are not.
Removed - posted at the same time as John Murray's answer above.