diff --git a/README.md b/README.md index 2d7a1be7..ec0f58b4 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) @@ -23,7 +24,7 @@ You can control the include paths to be used by the linter with the `fortran.includePaths` setting. -``` +``` jsonc { "fortran.includePaths": [ "/usr/local/include", @@ -34,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. -``` +``` jsonc { "fortran.gfortranExecutable": '/usr/local/bin/gfortran-4.7', } @@ -42,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. -``` +``` jsonc { "fortran.linterExtraArgs": ['-Wall'], } @@ -50,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 -``` +``` jsonc { "fortran.symbols": [ "function", "subroutine"] } @@ -68,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 -``` +``` jsonc { "fortran.preferredCase": "lowercase" | "uppercase" } @@ -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: + +``` jsonc +{ + // 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) diff --git a/package.json b/package.json index 19bea2df..119fc7cc 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,16 @@ "categories": [ "Programming Languages", "Snippets", - "Linters" + "Linters", + "Debuggers" ], "activationEvents": [ "onLanguage:FortranFreeForm" ], "main": "./out/src/extension", + "extensionDependencies": [ + "ms-vscode.cpptools" + ], "contributes": { "languages": [ { @@ -84,6 +88,14 @@ "path": "./snippets/fortran90.json" } ], + "breakpoints": [ + { + "language": "FortranFreeForm" + }, + { + "language": "fortran_fixed-form" + } + ], "configuration": { "type": "object", "title": "Fortran configuration", @@ -182,4 +194,4 @@ "dependencies": { "vscode-languageclient": "^5.1.0" } -} +} \ No newline at end of file