From 405a971b72bdbf4eb287775c7f7da74ce5556afd Mon Sep 17 00:00:00 2001 From: Giannis Nikiteas Date: Thu, 3 Oct 2019 19:04:44 +0100 Subject: [PATCH 1/5] Added debugging functionality. --- package.json | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 19bea2df..ec46c152 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "categories": [ "Programming Languages", "Snippets", - "Linters" + "Linters", + "Debuggers" ], "activationEvents": [ "onLanguage:FortranFreeForm" @@ -84,6 +85,18 @@ "path": "./snippets/fortran90.json" } ], + "debuggers": [ + { + "type": "cppdbg", + "label": "Fortran (GDB)", + "enableBreakpointsFor": { + "languageIds": [ + "FortranFreeForm", + "fortran_fixed-form" + ] + } + } + ], "configuration": { "type": "object", "title": "Fortran configuration", @@ -182,4 +195,4 @@ "dependencies": { "vscode-languageclient": "^5.1.0" } -} +} \ No newline at end of file From ac638607b71caf1bf27ebe5fed758c139abfb439 Mon Sep 17 00:00:00 2001 From: Giannis Nikiteas Date: Thu, 27 Feb 2020 16:05:33 +0000 Subject: [PATCH 2/5] Replaces deprecated debugger interface. As stated in issue #9037 in github.com/microsoft/vscode is the way to go. Fortran does not do anything different from the inhouse C++ debugger, hence we should only have the extension allow breaking points and nothing else. This of course means that we will be depending on Microsoft's C++ extension for the debugger. --- package.json | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index ec46c152..119fc7cc 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "onLanguage:FortranFreeForm" ], "main": "./out/src/extension", + "extensionDependencies": [ + "ms-vscode.cpptools" + ], "contributes": { "languages": [ { @@ -85,16 +88,12 @@ "path": "./snippets/fortran90.json" } ], - "debuggers": [ + "breakpoints": [ { - "type": "cppdbg", - "label": "Fortran (GDB)", - "enableBreakpointsFor": { - "languageIds": [ - "FortranFreeForm", - "fortran_fixed-form" - ] - } + "language": "FortranFreeForm" + }, + { + "language": "fortran_fixed-form" } ], "configuration": { From b34ed6f65988b4d816af4d7d9b62f0e5c05b869a Mon Sep 17 00:00:00 2001 From: Giannis Nikiteas Date: Thu, 27 Feb 2020 17:42:43 +0000 Subject: [PATCH 3/5] Updated README.md to include debugging as feature --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d7a1be7..4cf6d4c7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Installs](https://vsmarketplacebadge.apphb.com/installs/krvajalm.linter-gfortran.svg)](https://marketplace.visualstudio.com/items?itemName=krvajalm.linter-gfortran) [![GitHub release](https://img.shields.io/github/release/krvajal/vscode-fortran-support.svg)](https://GitHub.com/krvajal/vscode-fortran-support/releases/) -> This extension provides support for the Fortran programming language. It includes syntax highlighting, code snippets and a linting based on `gfortran`. You can download the Visual Studio Code editor from [here](https://code.visualstudio.com/download). +> This extension provides support for the Fortran programming language. It includes syntax highlighting, debugging, code snippets and a linting based on `gfortran`. You can download the Visual Studio Code editor from [here](https://code.visualstudio.com/download). ## Features @@ -16,6 +16,7 @@ - Code linting based on `gfortran` to show errors wiggles in your code - Code autocompletion (beta) - Symbols provider +- Debugger, uses Microsoft's [C/C++ extension](https://github.com/Microsoft/vscode-cpptools) ![symbol_nav](./doc/symbol_nav.png) @@ -90,10 +91,65 @@ This is a list of some of the snippets included, if you like to include addition To trigger code validations you must save the file first. +## Debugging + +The extension uses the debugger from Microsoft's +[C/C++ extension](https://github.com/Microsoft/vscode-cpptools) +for Visual Studio Code. This allows this extension to use the full functionality +of the C/C++ extension for debugging applications: +(un)conditional breaking points, expression evaluation, multi-threaded debugging, +call stack, stepping, watch window. + +A minimal `launch.json` script, responsible for controlling the debugger, is +provided below. However, Visual Studio Code is also capable of autogenerating +a `launch.json` file and the configurations inside the file. + +More details about how to setup the debugger can be found in Microsoft's website: + +- General information about debugging in VS Code: +- C/C++ extension debugger information: +- Build tasks for easy compiling: + +``` json +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Fortran", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/a.out", + "args": [], // Possible input args for a.out + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} +``` + ## Requirements For the linter to work you need to have `gfortran` on your path, or wherever you configure it to be. +For debugging you need to have one of the following debuggers installed: + +- **Linux**: GDB +- **macOS**: GDB or LLDB +- **Windows**: GDB or Visual Studio Windows Debugger + ## Issues Please report any issues and feature request on the GitHub repo [here](https://github.com/krvajalmiguelangel/vscode-fortran-support/issues/new) From 386ea906fb3cd94ae68095e27dcd8e3cbb24ffc2 Mon Sep 17 00:00:00 2001 From: Giannis Nikiteas Date: Thu, 27 Feb 2020 17:44:14 +0000 Subject: [PATCH 4/5] Marked code snippets as JSON --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4cf6d4c7..4db0fbe6 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You can control the include paths to be used by the linter with the `fortran.includePaths` setting. -``` +``` json { "fortran.includePaths": [ "/usr/local/include", @@ -35,7 +35,7 @@ You can control the include paths to be used by the linter with the `fortran.inc By default the `gfortran` executable is assumed to be found in the path. In order to use a different one or if it can't be found in the path you can point the extension to use a custom one with the `fortran.gfortranExecutable` setting. -``` +``` json { "fortran.gfortranExecutable": '/usr/local/bin/gfortran-4.7', } @@ -43,7 +43,7 @@ By default the `gfortran` executable is assumed to be found in the path. In orde If you want to pass extra options to the `gfortran` executable or override the default one, you can use the setting `fortran.linterExtraArgs`. By default `-Wall` is the only option. -``` +``` json { "fortran.linterExtraArgs": ['-Wall'], } @@ -51,7 +51,7 @@ If you want to pass extra options to the `gfortran` executable or override the d You can configure what kind of symbols will appear in the symbol list by using -``` +``` json { "fortran.symbols": [ "function", "subroutine"] } @@ -69,7 +69,7 @@ and by default only functions and subroutines are shown You can also configure the case for fortran intrinsics auto-complete by using -``` +``` json { "fortran.preferredCase": "lowercase" | "uppercase" } From 2d417a906a26eaaa00ffabdee219bb20d0a08b48 Mon Sep 17 00:00:00 2001 From: Giannis Nikiteas Date: Thu, 27 Feb 2020 17:50:06 +0000 Subject: [PATCH 5/5] Attempt to fix highlighting on GitHub --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4db0fbe6..ec0f58b4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You can control the include paths to be used by the linter with the `fortran.includePaths` setting. -``` json +``` jsonc { "fortran.includePaths": [ "/usr/local/include", @@ -35,7 +35,7 @@ You can control the include paths to be used by the linter with the `fortran.inc By default the `gfortran` executable is assumed to be found in the path. In order to use a different one or if it can't be found in the path you can point the extension to use a custom one with the `fortran.gfortranExecutable` setting. -``` json +``` jsonc { "fortran.gfortranExecutable": '/usr/local/bin/gfortran-4.7', } @@ -43,7 +43,7 @@ By default the `gfortran` executable is assumed to be found in the path. In orde If you want to pass extra options to the `gfortran` executable or override the default one, you can use the setting `fortran.linterExtraArgs`. By default `-Wall` is the only option. -``` json +``` jsonc { "fortran.linterExtraArgs": ['-Wall'], } @@ -51,7 +51,7 @@ If you want to pass extra options to the `gfortran` executable or override the d You can configure what kind of symbols will appear in the symbol list by using -``` json +``` jsonc { "fortran.symbols": [ "function", "subroutine"] } @@ -69,7 +69,7 @@ and by default only functions and subroutines are shown You can also configure the case for fortran intrinsics auto-complete by using -``` json +``` jsonc { "fortran.preferredCase": "lowercase" | "uppercase" } @@ -110,7 +110,7 @@ More details about how to setup the debugger can be found in Microsoft's website - C/C++ extension debugger information: - Build tasks for easy compiling: -``` json +``` jsonc { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes.