generated from teksi/template
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add VS Code development environment #432
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
14b557a
Add editorconfig to define consistent formatting
Philippluca 7018c85
Add VS Code Development environment
Philippluca 6b2baa8
Use english for comments
Philippluca fa8850c
Start debugpy debug server
Philippluca b989b5f
Remove settings.json and define OS specific executables
Philippluca dcd050b
Require Developer mode for debug server.
Philippluca 586a087
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fb8dafb
Use qgis binary on linux
Philippluca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"ms-python.python", | ||
], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [ | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Remote Attach", | ||
"type": "debugpy", | ||
"request": "attach", | ||
"connect": { | ||
"host": "localhost", | ||
"port": 5678 | ||
}, | ||
"pathMappings": [ | ||
{ | ||
"localRoot": "${workspaceFolder}", | ||
"remoteRoot": "${workspaceFolder}" | ||
} | ||
], | ||
"justMyCode": false | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"qgis.installationRoot": "C:\\Program Files\\QGIS 3.34.10", | ||
"qgis.executable": "${config:qgis.installationRoot}\\bin\\qgis-ltr-bin.exe", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Install dependencies", | ||
"type": "shell", | ||
"command": "pip install debugpy \"sqlalchemy~=1.3.22\" \"geoalchemy2>=0.9.0\"", | ||
"options": { | ||
"shell": { | ||
"executable": "${config:qgis.installationRoot}\\OSGeo4W.bat" | ||
} | ||
}, | ||
"problemMatcher": [] | ||
}, | ||
{ | ||
"label": "docker-db", | ||
"type": "docker-compose", | ||
"dockerCompose": { | ||
"up": { | ||
"detached": true, | ||
"build": false, | ||
"services": [ | ||
"db" | ||
] | ||
}, | ||
"files": [ | ||
"${workspaceFolder}/docker-compose.yml" | ||
] | ||
} | ||
}, | ||
{ | ||
"label": "Launch QGIS", | ||
"type": "process", | ||
"command": "${config:qgis.executable}", | ||
"args": [ | ||
"--project", | ||
"${workspaceFolder}\\project\\teksi_wastewater.qgs" | ||
], | ||
"runOptions": { | ||
"instanceLimit": 1, | ||
"reevaluateOnRerun": false | ||
}, | ||
"dependsOn": [ | ||
"docker-db" | ||
], | ||
"problemMatcher": [], | ||
"options": { | ||
"env": { | ||
"QGIS_PLUGINPATH": "${workspaceFolder}\\plugin", | ||
"QGIS_PLUGIN_USE_DEBUGGER": "debugpy", | ||
"PGSERVICEFILE": "${workspaceFolder}\\project\\pg_service.conf" | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[pg_tww] | ||
# Configuration for TEKSI development database in docker | ||
host=localhost | ||
port=5432 | ||
user=postgres | ||
password=postgres | ||
dbname=tww |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using OSGEO4W installer which is recommended by TEKSI, the path will be different.
eg : C:\OSGeo4W\bin\qgis-ltr-bin.exe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Should this recommendation be placed within the README.md as well?
The settings.json was intended as a template. User can overwrite the settings in vscode. See also comment in README.md:
If QGIS & Shell would be found on PATH on all Plattform, the configuration would be much simpler. Alternatively, if the required version / distribution of QGIS could be specified we would have the option to write a platform aware launch.json without using the "hacky" settings.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we adapt .vscode/settings.json will it not always show as modified in git status?
Maybe the needed path could be defined in system variables. If not set, just use the most common variant (porbably windows/OSGeo4w ?).
Or providing the file as a
settings.json.default
to be renamed?But I am not used to this kind of vscode configuration I don't now what's the best way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to use OSGeo4w as default in settings.json and adapting it to
qgis.installationRoot.windows
. If we run int in vscode the value either is correct, or the developer will get a message like "C:\OSGeo4w\qgis.bar was not found." I assume every developer will get a hint of what to do. OSGeo4w, in the optimal case, defines a link for the lates installed QGIS version to use. Corresponding linux variant can then be added as well.The approuch should not depend on any environment variables defined from outside of VSCode as this break the whole concept of "no setup needed launch configuration".