├── .github ├── FUNDING.yml └── workflows │ ├── release.yml │ └── workflow.yml ├── .gitignore ├── .gitmodules ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── ISSUE_TEMPLATE.md ├── LICENSE.md ├── README.md ├── docs-src ├── build.d ├── building.md ├── debugging.md ├── dub.md ├── editing.md ├── hello-world.md ├── include │ ├── menu.md │ └── sponsor.md ├── index.md ├── install.md ├── intro-to-d.md ├── non-dub.md ├── troubleshooting.md └── vibe-d.md ├── docs ├── building.md ├── debugging.md ├── dub.md ├── editing.md ├── hello-world.md ├── images │ ├── action_auto_import.png │ ├── action_implement_interface.png │ ├── all_srcs.png │ ├── breadcrumb.png │ ├── build_arch.png │ ├── build_compiler.png │ ├── build_configuration.png │ ├── build_list.png │ ├── build_run_output.png │ ├── build_types.png │ ├── calltips.png │ ├── code_dfmt_off.png │ ├── code_formatted.png │ ├── code_linting.png │ ├── code_unformatted.png │ ├── coverage.png │ ├── coverage_bottom.png │ ├── create_vibed_project.png │ ├── create_vibed_project_files.png │ ├── ddoc_complete.png │ ├── debug_existing.png │ ├── debug_fresh.png │ ├── debug_fresh2.png │ ├── debug_status_bar.png │ ├── default_srcs.png │ ├── dpldocs.png │ ├── dpldocs_context_menu.png │ ├── dpldocs_site.png │ ├── dub_dependency_list.png │ ├── dub_json_file.png │ ├── dub_json_file_big.png │ ├── dub_panel.png │ ├── dub_panel_full.png │ ├── dub_sdl_file.png │ ├── ext_code_lldb.png │ ├── ext_cpp.png │ ├── ext_native_debug.png │ ├── extension_installed.png │ ├── fixed_dependency_version.png │ ├── full_ddoc_complete.png │ ├── full_ddoc_complete_done.png │ ├── gc_profile.png │ ├── import_timing.png │ ├── missing_auto_complete.png │ ├── missing_dependency_version.png │ ├── outline.png │ ├── output_tab.png │ ├── output_tab_served_dropdown.png │ ├── project_import_paths.png │ ├── quick_outline.png │ ├── reload.png │ ├── run_task.png │ ├── run_with_rdmd.png │ ├── sorted_imports.png │ ├── sponsor.png │ ├── task_configure.png │ ├── task_configure_list.png │ ├── task_generated.png │ ├── tasks_run.png │ ├── unsorted_imports.png │ ├── verbose_config_key.png │ ├── verbose_output_tab.png │ ├── vibed_output.png │ ├── vibed_website.png │ ├── vscode_reload_button.png │ └── workspace_outline.png ├── index.md ├── install.md ├── intro-to-d.md ├── non-dub.md ├── troubleshooting.md ├── tutorial.md ├── vibe-d.md ├── video_create_project.gif ├── video_create_project.mp4 ├── video_open_folder.gif ├── video_open_folder.mp4 ├── video_snippets.gif └── video_snippets.mp4 ├── html ├── dubeditor.css ├── dubeditor.html └── dubeditor.js ├── images ├── adddep-dark.svg ├── adddep-light.svg ├── authors-dark.svg ├── authors-light.svg ├── dependency-dark.svg ├── dependency-light.svg ├── description-dark.svg ├── description-light.svg ├── dlogo-square.png ├── dlogo-square.svg ├── dub-convert-inverse.svg ├── dub-convert.svg ├── edit-dub-inverse.svg ├── edit-dub.svg ├── edit-source-inverse.svg ├── edit-source.svg ├── github │ ├── ddoc_new_writeln.png │ └── dfmt_argument_translation.png ├── license-dark.svg ├── license-light.svg ├── refresh-dark.svg ├── refresh-light.svg ├── sponsor.png ├── tutorial │ └── project-creation │ │ ├── step1.png │ │ ├── step2.png │ │ ├── step3.png │ │ ├── step4.png │ │ ├── step5.png │ │ ├── step6.png │ │ ├── step7.png │ │ ├── step8.png │ │ ├── step9.png │ │ └── stepA.png ├── web-dark.svg └── web-light.svg ├── json-validation └── dub.schema.json ├── lang-configs ├── d.json ├── diet.json └── general.json ├── package-lock.json ├── package.json ├── res ├── exe │ └── install.sh ├── images │ └── create-launch-json.png └── walkthroughs │ ├── debugProject.md │ ├── installCompiler.md │ └── userSettings.md ├── snippets └── diet.json ├── sponsors └── weka.png ├── src ├── api_impl.ts ├── builtin_plugins.ts ├── commands.ts ├── compilers.ts ├── coverage.ts ├── debug.ts ├── dmode.ts ├── dpldocs.ts ├── dub-api.ts ├── dub-editor.ts ├── dub-json.ts ├── dub-tasks.ts ├── dub-view.ts ├── extension.ts ├── gcprofiler.ts ├── installer.ts ├── json-contributions.ts ├── project-creator.ts ├── sdl │ ├── sdl-contributions.ts │ ├── sdlinfo.ts │ └── sdlparse.ts ├── statusbar.ts ├── terminal-link-provider.ts ├── test │ ├── ci │ │ ├── .gitignore │ │ ├── syntax │ │ │ ├── d │ │ │ │ ├── array_comment.d │ │ │ │ ├── array_comment.d.expected │ │ │ │ ├── calls.d │ │ │ │ ├── calls.d.expected │ │ │ │ ├── comments.d │ │ │ │ ├── comments.d.expected │ │ │ │ ├── delegate.d │ │ │ │ ├── delegate.d.expected │ │ │ │ ├── enum.d │ │ │ │ ├── enum.d.expected │ │ │ │ ├── enum_type.d │ │ │ │ ├── enum_type.d.expected │ │ │ │ ├── ifs.d │ │ │ │ ├── ifs.d.expected │ │ │ │ ├── issue_288.d │ │ │ │ ├── issue_288.d.expected │ │ │ │ ├── keyword_types.d │ │ │ │ ├── keyword_types.d.expected │ │ │ │ ├── ligatures.d │ │ │ │ ├── ligatures.d.expected │ │ │ │ ├── semicolons.d │ │ │ │ ├── semicolons.d.expected │ │ │ │ ├── static_foreach.d │ │ │ │ ├── static_foreach.d.expected │ │ │ │ ├── static_if.d │ │ │ │ ├── static_if.d.expected │ │ │ │ ├── token_strings.d │ │ │ │ └── token_strings.d.expected │ │ │ └── diet │ │ │ │ ├── empty.dt │ │ │ │ ├── empty.dt.expected │ │ │ │ ├── extends.dt │ │ │ │ ├── extends.dt.expected │ │ │ │ ├── normal.dt │ │ │ │ ├── normal.dt.expected │ │ │ │ ├── one.dt │ │ │ │ └── one.dt.expected │ │ └── syntaxes.test.ts │ ├── runTest.ts │ ├── suite │ │ ├── index.ts │ │ ├── it.test.ts │ │ ├── sdlparse.test.ts │ │ ├── semver.test.ts │ │ └── terminal_links.test.ts │ └── utils.ts ├── testprovider.ts ├── uninstall.ts └── util.ts ├── syntaxes ├── codeblock.json ├── d.json ├── d.yml ├── d.yml-LICENSE ├── diet.json ├── diet.yml ├── dml.json ├── dml.yml ├── sdl.json └── sdl.yml ├── templates ├── BasicConsole │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── config.json │ └── source │ │ ├── app.d │ │ └── config.d ├── BasicVibeServer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── public │ │ └── css │ │ │ └── style.css │ ├── source │ │ └── app.d │ └── views │ │ └── index.dt ├── EmptyConsole │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ └── source │ │ └── app.d ├── EmptyDiamondWebApi │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── config │ │ ├── controllers.config │ │ └── web.json │ ├── controllers │ │ ├── homecontroller.d │ │ └── package.d │ ├── core │ │ └── websettings.d │ └── models │ │ └── package.d ├── EmptyDiamondWebsite │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── config │ │ ├── views.config │ │ └── web.json │ ├── controllers │ │ ├── homecontroller.d │ │ └── package.d │ ├── core │ │ └── websettings.d │ ├── models │ │ └── package.d │ └── views │ │ ├── home.dd │ │ └── layout.dd ├── EmptyDlangUI │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── source │ │ └── app.d │ └── views │ │ └── MainWindow.dml ├── EmptyGTKD │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ └── source │ │ └── app.d ├── EmptyLegacyOpenGL_SDL │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ └── source │ │ └── app.d ├── EmptyOpenGL_SDL │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ ├── source │ │ └── app.d │ └── views │ │ ├── shader.frag │ │ └── shader.vert ├── EmptyVibeServer │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ └── source │ │ └── app.d ├── EmptyWin32 │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ └── source │ │ └── app.d ├── EmptyX11 │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── tasks.json │ └── source │ │ └── app.d └── info.json ├── tsconfig.json └── typings.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [WebFreak001] 2 | patreon: WebFreak 3 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release vsix to OpenVSX and VSCode marketplace 2 | on: 3 | release: 4 | types: [published] 5 | 6 | jobs: 7 | release: 8 | name: "Release" 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | with: 13 | submodules: true 14 | 15 | - name: Set Node.js 10.x 16 | uses: actions/setup-node@master 17 | with: 18 | version: 14.x 19 | 20 | - name: npm install 21 | run: npm install 22 | 23 | - name: typescript 24 | run: npx tsc 25 | 26 | - name: Publish to Open VSX Registry 27 | uses: HaaLeo/publish-vscode-extension@v0 28 | id: publishToOpenVSX 29 | with: 30 | pat: ${{ secrets.OPEN_VSX_TOKEN }} 31 | - name: Publish to Visual Studio Marketplace 32 | uses: HaaLeo/publish-vscode-extension@v0 33 | with: 34 | pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} 35 | registryUrl: https://marketplace.visualstudio.com 36 | extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }} 37 | packagePath: '' 38 | - name: Upload 39 | uses: djn24/add-asset-to-release@v1 40 | with: 41 | token: ${{secrets.GITHUB_TOKEN}} 42 | path: ${{ steps.publishToOpenVSX.outputs.vsixPath }} 43 | -------------------------------------------------------------------------------- /.github/workflows/workflow.yml: -------------------------------------------------------------------------------- 1 | name: Test ci folder 2 | on: [push] 3 | 4 | jobs: 5 | npm_test: 6 | name: Run npm tests 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest, windows-latest] 11 | steps: 12 | - uses: actions/checkout@v4 13 | 14 | - name: Install D compiler 15 | uses: dlang-community/setup-dlang@v2 16 | with: 17 | compiler: dmd 18 | 19 | - name: Start xvfb 20 | if: startsWith(matrix.os, 'ubuntu') 21 | run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & 22 | 23 | - name: Set Node.js 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: lts/* 27 | 28 | - name: npm install 29 | run: npm install 30 | 31 | - name: typescript 32 | run: npx tsc 33 | 34 | - name: npm test 35 | env: 36 | CODE_VERSION: '' 37 | DISPLAY: ':99.0' 38 | run: npm test 39 | 40 | - name: test grammar 41 | if: startsWith(matrix.os, 'ubuntu') 42 | run: npm run grammar 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .vscode-test/ 4 | private/ 5 | *.vsix 6 | bin 7 | package-lock.json -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dlang-debug"] 2 | path = dlang-debug 3 | url = https://github.com/Pure-D/dlang-debug.git 4 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}"], 11 | "stopOnEntry": false, 12 | "sourceMaps": true, 13 | "outFiles": ["${workspaceRoot}/out/**/*.js"], 14 | "preLaunchTask": "npm" 15 | }, 16 | { 17 | "name": "Launch Tests", 18 | "type": "extensionHost", 19 | "request": "launch", 20 | "runtimeExecutable": "${execPath}", 21 | "args": [ 22 | "--extensionDevelopmentPath=${workspaceRoot}", 23 | "--extensionTestsPath=${workspaceRoot}/out/test/suite/index" 24 | ], 25 | "stopOnEntry": false, 26 | "sourceMaps": true, 27 | "outFiles": ["${workspaceRoot}/out/test/**/*.js"], 28 | "preLaunchTask": "npm" 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | "typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version 10 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${fileBasename}: the current opened file's basename 5 | // ${fileDirname}: the current opened file's dirname 6 | // ${fileExtname}: the current opened file's extension 7 | // ${cwd}: the current working directory of the spawned process 8 | 9 | // A task runner that calls a custom npm script that compiles the extension. 10 | { 11 | "version": "2.0.0", 12 | 13 | // we want to run npm 14 | "command": "npm", 15 | 16 | // the command is a shell script 17 | "type": "shell", 18 | 19 | // we run the custom script "compile" as defined in package.json 20 | "args": ["run", "compile", "--loglevel", "silent"], 21 | 22 | // The tsc compiler is started in watching mode 23 | "isBackground": true, 24 | 25 | // use the standard tsc in watch mode problem matcher to find compile problems in the output. 26 | "problemMatcher": "$tsc-watch" 27 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .github/** 3 | typings/** 4 | out/test/** 5 | docs-src/** 6 | test/** 7 | src/** 8 | ci/** 9 | private/** 10 | **/*.map 11 | .gitignore 12 | tsconfig.json 13 | vsc-extension-quickstart.md 14 | images/tutorial/** 15 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jan Jurzitza 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Code-D 2 | 3 | Join the chat: [![Join on Discord](https://discordapp.com/api/guilds/242094594181955585/widget.png?style=shield)](https://discord.gg/Bstj9bx) 4 | 5 | Adds advanced IDE support for the [D Programming Language](https://dlang.org) to Visual Studio Code. Powered by [serve-d](https://github.com/Pure-D/serve-d). 6 | 7 | Also [available for Atom](https://github.com/Pure-D/atomize-d)! 8 | 9 | ## Features 10 | 11 | * Auto-Completion 12 | * Code formatting 13 | * Static linting + Build linting 14 | * Outlining and searching for symbols 15 | * Refactorings for code diagnostics 16 | * and [much more](https://github.com/Pure-D/code-d/wiki) 17 | 18 | ## Special Thanks 19 | 20 | ### Corporate Sponsors 21 | 22 | Development on code-d/serve-d tools is sponsored by 23 | 24 | | [![Weka.IO Logo](sponsors/weka.png)](https://weka.io) | 25 | |:---:| 26 | | **[Weka.IO](https://weka.io)** | 27 | 28 | If you are looking for a Job with D, check out the companies listed above! 29 | 30 | _For professional D consulting, programming services or corporate support with D IDE tools, DUB and the ecosystem, contact me through [dlang@wfr.software](mailto:dlang@wfr.software)_ 31 | 32 | ### Individual Sponsors 33 | 34 | **Thanks to the following big GitHub sponsors** financially supporting the code-d/serve-d tools: 35 | 36 | | [![ZyeByte's GitHub avatar](https://avatars.githubusercontent.com/u/102230672?s=96&v=4)]((https://github.com/zyebytevt)) | 37 | |:---:| 38 | | [@zyebytevt](https://github.com/zyebytevt) | 39 | 40 | 43 | 44 | _[become a sponsor](https://github.com/sponsors/WebFreak001)_ 45 | 46 | ### Development 47 | 48 | Thanks to @Hackerpilot for his great IDE software that serve-d built upon. 49 | 50 | Thanks to the D package registry, especially @s-ludwig for their great package manager and library "dub". 51 | 52 | Thanks to all contributors to [code-d](https://github.com/Pure-D/code-d/graphs/contributors) and [serve-d](https://github.com/Pure-D/serve-d/graphs/contributors). 53 | 54 | ## Installation 55 | 56 | ### Prerequirements: 57 | D compiler with environment variables set. Downloads [here](https://dlang.org/download.html), details [here](https://wiki.dlang.org/Compilers) 58 | 59 | ### code-d installation 60 | 61 | * Automatic: 62 | Open Visual Studio Code and install the _code-d_ extension the normal way: 63 | 64 | ``` 65 | ext install webfreak.code-d 66 | ``` 67 | 68 | Or search for code-d and select the "D Programming Language (code-d)" extension from the list. 69 | 70 | * Manual (if the automatic way doesn't work) 71 | 72 | ``` 73 | # discouraged if you are trying out code-d, you should preferably install it from the marketplace 74 | 75 | cd ~/.vscode/extensions/ 76 | git clone https://github.com/Pure-D/code-d.git 77 | cd code-d 78 | npm install 79 | npx tsc -p . 80 | ``` 81 | 82 | code-d will automatically install [serve-d](https://github.com/Pure-D/serve-d), 83 | [dcd](https://github.com/dlang-community/DCD) and [dub](https://code.dlang.org/download) 84 | if they are not already installed. 85 | 86 | ## License 87 | 88 | MIT - Look in [LICENSE.md](LICENSE.md) for more information 89 | 90 | ## Issues 91 | 92 | Please submit issues to [github](https://github.com/Pure-D/code-d) 93 | 94 | ## Special developer config 95 | 96 | use `"d.forceUpdateServeD": true` to force an outdated prompt on startup. 97 | 98 | use `"d.forceCompileServeD": true` to force compilation of serve-d instead of downloading pre-compiled releases. 99 | -------------------------------------------------------------------------------- /docs-src/build.d: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rdmd 2 | 3 | import std; 4 | 5 | void main(string[] args) 6 | { 7 | foreach (f; dirEntries(".", SpanMode.shallow)) 8 | { 9 | if (!f.name.endsWith(".md")) 10 | continue; 11 | 12 | auto name = baseName(f); 13 | auto output = File(chainPath("..", "docs", name), "wb"); 14 | auto input = File(f, "rb"); 15 | 16 | output.write("\n\n"); 17 | 18 | int lineNo; 19 | foreach (line; input.byLine(KeepTerminator.yes)) 20 | { 21 | lineNo++; 22 | if (line.startsWith("#include")) 23 | { 24 | output.write("\n\n"); 25 | 26 | auto imp = line["#include".length .. $].strip; 27 | auto src = File(chainPath("include", imp), "rb"); 28 | foreach (c; src.byChunk(4096)) 29 | output.rawWrite(c); 30 | } 31 | else if (line.startsWith("#menu")) 32 | { 33 | auto src = File(chainPath("include", "menu.md"), "rb"); 34 | output.writeln(`
`); 35 | output.writeln(); 36 | foreach (l; src.byLine) 37 | { 38 | // condense 39 | if (!l.length) 40 | continue; 41 | 42 | if (l.endsWith(name.format!"(%s)")) 43 | { 44 | auto link = l.indexOf('['); 45 | assert(link != -1); 46 | output.writeln(l[0 .. link], "**", l[link .. $], "**"); 47 | } 48 | else 49 | output.writeln(l); 50 | } 51 | output.writeln(); 52 | output.writeln(`
`); 53 | } 54 | else 55 | { 56 | lintLinks(line, name, lineNo); 57 | output.rawWrite(line); 58 | } 59 | } 60 | } 61 | } 62 | 63 | void lintLinks(const(char)[] line, const(char)[] src, int lineNo) 64 | { 65 | ptrdiff_t last; 66 | while (true) 67 | { 68 | auto i = line.indexOf(')', last); 69 | if (i == -1) 70 | break; 71 | auto start = line.lastIndexOf('(', i); 72 | if (start <= 0) 73 | break; 74 | auto content = line[start + 1 .. i]; 75 | 76 | if (!content.startsWith("http:", "https:", "data:", "command:", "/") && line[start - 1] == ']') 77 | { 78 | auto hash = content.indexOf('#'); 79 | if (hash != -1) 80 | content = content[0 .. hash]; 81 | 82 | if (content.length && !exists(content) && !exists(chainPath("..", "docs", content))) 83 | { 84 | stderr.writeln("Warning: dead link in ", src, ":", lineNo, ": ", content); 85 | } 86 | } 87 | 88 | last = i + 1; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /docs-src/dub.md: -------------------------------------------------------------------------------- 1 | # Tutorial 2 | 3 | #menu 4 | 5 | ## DUB Package Manager 6 | 7 | code-d offers full integration for the DUB package manager for all development purposes. This includes: 8 | 9 | - Full file support for dub.json and dub.sdl 10 | - Dependency management within VSCode 11 | - Add/Remove/Upgrade dependencies 12 | - Go to definition, auto complete, etc. 13 | - Building 14 | - Creation 15 | 16 | ### "DUB Dependencies" Panel 17 | 18 | The first entry point to the dub dependencies is the "DUB Dependencies" panel in the files list: 19 | 20 | ![dub dependencies panel](images/dub_panel.png) 21 | 22 | Using the first button dependencies can automatically be added to the dub package file in the project. 23 | 24 | ![add dub dependencies list](images/dub_dependency_list.png) 25 | 26 | Adding a dependency will automatically add it to the dub package file. 27 | 28 | To remove or update a dependency, right click it and select the desired option. 29 | 30 | When first adding a dependency it will be missing any version from the list: 31 | 32 | ![dub dependencies panel with missing dependency version](images/missing_dependency_version.png) 33 | 34 | This also means that auto completion and other features for this dependency won't work. To fix this, open the command line and enter 35 | 36 | ``` 37 | dub upgrade 38 | ``` 39 | 40 | to make dub download all dependencies. 41 | 42 | When done, press the reload button at the right to refresh the local dependencies. (subject to change) 43 | 44 | ![working dub dependencies panel](images/fixed_dependency_version.png) 45 | 46 | Any dependency in this tree can be expanded and collapsed. Additionally it is possible to click on the dependencies to view the locally installed README files: 47 | 48 | ![readme example of vibe.d](images/dub_panel_full.png) 49 | 50 | It will also show much of the other information which can be put into the dub package files. This panel gives a quick and easy overview over the complexity of all dependencies and access to so. Viewing the README files makes it easy to view example code given by the language authors. 51 | 52 | ### Editing 53 | 54 | ![dub.json file](images/dub_json_file.png) 55 | 56 | Here code-d adds 2 buttons at the top of the bar for easier manipulation: 57 | 58 | The left-most button "Convert between dub.json/dub.sdl" will rename and convert the file to the other available format by dub. 59 | 60 | ![dub.sdl file](images/dub_sdl_file.png) 61 | 62 | Be aware that this will remove all comments from a dub.sdl and unknown directives from a dub.json file and reset all indentation. 63 | 64 | The middle button "Open project settings" opens a (currently disfunctional) GUI editor for the dub.json file. Note this functionality is only currently implemented for dub.json and not dub.sdl 65 | 66 | Auto completion and inline hover documentation in this file will usually guide you through everything you need to know. Refer to the [official documentation](https://dub.pm/package-format-json) for details. 67 | 68 | ![example big dub.json file](images/dub_json_file_big.png) 69 | 70 | ### Building 71 | 72 | See [building](building.md) 73 | 74 | ### Next Steps 75 | 76 | Create a [web server with vibe.d](vibe-d.md) 77 | -------------------------------------------------------------------------------- /docs-src/hello-world.md: -------------------------------------------------------------------------------- 1 | # Tutorial 2 | 3 | #menu 4 | 5 | ## Hello World 6 | 7 | ### Opening a Workspace 8 | 9 | code-d works best when folders are opened. 10 | 11 | For a simple project open a normal folder using the `Open Folder...` button. 12 | 13 | It's possible to add multiple folders to the workspace in VSCode using `File -> Add Folder to Workspace...`. 14 | 15 | Click `File -> Open Folder...` or `Ctrl-Shift-P -> Open Folder...` to open an empty folder as workspace for your project. 16 | 17 | ![example video](video_open_folder.gif) 18 | 19 | ### Working without workspace 20 | 21 | It is also possible to have projects with very few files and no dependencies whatsoever. For this you can also open a workspace as described above to have full feature access (such as build tasks and dependencies) but for quickly editing singular D files it is also possible to simply open them in VSCode. However auto completion is limited to only the standard library in this case, so it's not a good idea to work like this for bigger projects. 22 | 23 | ### Generating a Project using a Template 24 | 25 | code-d contains project templates to quick-start the creation of projects. 26 | 27 | Open an empty folder with the desired name for the project. 28 | 29 | Continue by opening the command palette (F1 or Ctrl-Shift-P) and run `code-d: Create new project`. Follow the wizard to create the project. 30 | 31 | ![example video](video_create_project.gif) 32 | 33 | ### Writing code 34 | 35 | You can now start coding away. To make this hello world project actually work, insert the following code: 36 | 37 | ```d 38 | import std.stdio; 39 | 40 | void main() 41 | { 42 | writeln("Hello World"); 43 | } 44 | ``` 45 | 46 | ### Things to note 47 | 48 | The example projects create a DUB project for you. (Noticable with the dub.json or dub.sdl file which is present at root level) 49 | 50 | This means you have access to the whole [D package registry](https://code.dlang.org) and can use DUB as build tool too. 51 | 52 | See [DUB homepage](https://dub.pm) for more information. 53 | 54 | ### Next Steps 55 | 56 | Next you might want to check out the chapter [Building](building.md) to see how you can now run your application. 57 | 58 | However if you don't want to use DUB for building and dependencies, check out [how to configure non-DUB projects](non-dub.md) 59 | 60 | You might also want to explore the [Editor Features](editing.md) code-d has to offer. 61 | -------------------------------------------------------------------------------- /docs-src/include/menu.md: -------------------------------------------------------------------------------- 1 | * [Home](index.md) 2 | 3 | * [Installation](install.md) 4 | 5 | * [Tutorial](intro-to-d.md) 6 | 7 | * [Intro to D](intro-to-d.md) 8 | 9 | * [Hello World](hello-world.md) 10 | 11 | * [Building](building.md) 12 | 13 | * [Debugging](debugging.md) 14 | 15 | * [Editing](editing.md) 16 | 17 | * [DUB Package Manager](dub.md) 18 | 19 | * [vibe.d Web App](vibe-d.md) 20 | 21 | * [Configuring non-DUB projects](non-dub.md) 22 | 23 | * [Troubleshooting](troubleshooting.md) 24 | 25 | * [Changelog](../CHANGELOG.md) 26 | -------------------------------------------------------------------------------- /docs-src/include/sponsor.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 30 | 31 |
Join the ChatDonate
8 | 9 | [![Join on Discord](https://discordapp.com/api/guilds/242094594181955585/widget.png?style=shield)](https://discord.gg/Bstj9bx) 10 | 11 | Discord chat 12 |
13 |
14 | Development 15 |
16 | & Support 17 | 18 |
20 | 21 | [![Sponsor me on GitHub Sponsors](images/sponsor.png)](https://github.com/sponsors/WebFreak001) 22 | 23 | Donate for faster 24 |
25 | development on 26 |
27 | code-d and serve-d 28 | 29 |
-------------------------------------------------------------------------------- /docs-src/index.md: -------------------------------------------------------------------------------- 1 |

code-d User Guide

2 | 3 | Welcome! Thank you for installing code-d. 4 | 5 | This document describes how you can effectively use code-d and D in Visual Studio Code from the ground up. 6 | 7 | **To open this at any later point, run `Ctrl-Shift-P -> code-d: Open User Guide / Documentation`** 8 | 9 | #include sponsor.md 10 | 11 | Click a link below to open pages about certain topics. 12 | 13 | #include menu.md 14 | 15 | --- 16 | 17 | **GitHub**: 18 | 19 | **Plugin**: https://github.com/Pure-D/code-d 20 | 21 | **Language Features**: https://github.com/Pure-D/serve-d 22 | -------------------------------------------------------------------------------- /docs-src/install.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | #menu 4 | 5 | First you have to install code-d in VSCode like any other extension from the side panel in VSCode. 6 | 7 | It's possible to manually download the vsix for manual installation from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=webfreak.code-d) or the [Open VSX Registry](https://open-vsx.org/extension/webfreak/code-d). 8 | 9 | ## First time installing D 10 | 11 | If you don't have D installed, code-d will open the [D compiler download page](https://dlang.org/download.html) for you where you simply select your compiler of choice and install it for your OS. 12 | 13 | On Windows it's a good idea to restart your PC after D is installed so it is accessible from PATH from within VSCode and its extensions. 14 | 15 | After D has been installed, restart VSCode and open a D project, everything should work now. 16 | 17 | ## Verifying functionality 18 | 19 | First open a folder with a D project or a blank one to create a project in. With a folder opened, simply open any D file and then in the bottom panels, check the **Output** tab. 20 | 21 | ![output tab to check](images/output_tab.png) 22 | 23 | In here at the right you should see a drop-down menu. If you can see `code-d & serve-d` in this then it means the extension is working and running. 24 | 25 | ![serve-d in the output panel drop down](images/output_tab_served_dropdown.png) 26 | 27 | If you experience any issues, check this tab for possible errors and log for debugging purposes when submitting an issue. 28 | 29 | For more information in case something doesn't work, refer to [Troubleshooting](troubleshooting.md). 30 | 31 | ## First steps 32 | 33 | [Tutorial](intro-to-d.md) 34 | -------------------------------------------------------------------------------- /docs-src/intro-to-d.md: -------------------------------------------------------------------------------- 1 | # Tutorial 2 | 3 | #menu 4 | 5 | ## Intro to D 6 | 7 | D is a general-purpose programming language with static typing, systems-level access, and C-like syntax. 8 | 9 | There are great resources online to learn D. Check out the following selection for high quality beginner-friendly D tutorials: 10 | 11 | - [Language Reference](https://dlang.org/spec/spec.html) (official reference) 12 | 13 | Exhaustive list of all grammatical constructs in the language in easy to read language. Great for people with some previous experience in programming. 14 | 15 | Must-read at some point when programming in D. 16 | 17 | - [DLang Tour](https://tour.dlang.org/) (community-maintained) 18 | 19 | Multi language, extensive tutorial page covering a lot of basics for people with some previous experience in programming. Covers multiple topics and standard library and is a great place to check out. 20 | 21 | - [Programming in D](http://ddili.org/ders/d.en/) 22 | 23 | Great book about D. Available in English or Turkish and as Paper Book, e-Book and online website. Although having experience in other programming languages is certainly helpful, this book starts from the basics. 24 | 25 | ## Community Support 26 | 27 | - [D Forum Learn Group](https://forum.dlang.org/group/learn) 28 | 29 | Great place to ask complex questions and get the most feedback. Available online or as mailing list. 30 | 31 | - [StackOverflow](https://stackoverflow.com/) 32 | 33 | Use the `d` tag for D questions, perfect to ask general questions when there isn't anything online. 34 | 35 | - [D Language Code Club (discord)](https://discord.gg/Bstj9bx) 36 | 37 | Official Discord chat of the code-d extension. Active and fast community support for most of the day and also support for code-d issues. More links for D resources here too. 38 | 39 | ## Next Steps 40 | 41 | Start writing a [Hello World](hello-world.md) project. 42 | -------------------------------------------------------------------------------- /docs-src/non-dub.md: -------------------------------------------------------------------------------- 1 | # Tutorial 2 | 3 | #menu 4 | 5 | ## Configuring non-DUB projects 6 | 7 | By default code-d loads the project folder itself and then each dub project in child folders as separate root. 8 | 9 | Without dub by default it will only load the project folder itself as root but it's possible to specify multiple roots in one folder for multiple projects in one folder. For this, specify `d.extraRoots` in your workspace settings with relative paths to each folder that is supposed to be treated as separate project. 10 | 11 | In each root code-d checks if one of the following folders exist if there is no dub and the `d.projectImportPaths` user setting is not set: 12 | - `source/` 13 | - `src/` 14 | 15 | The first one off that list is going to be picked as source directory for that root. If none of those exist, the folder itself is going to be used as directory for sources. By specifying `d.projectImportPaths` it is possible to override this behavior to use a custom defined source folder path. All paths in `d.projectImportPaths` are relative to the project folder and all roots will have the same import paths with this. 16 | 17 | ![example showing root source files](images/default_srcs.png) 18 | 19 | You can see that imports from local files are auto-completed with no problems. However when trying to use files from external folders (such as here, the `ext/` folder) the auto completion will not find these symbols. 20 | 21 | To fix this, change `d.projectImportPaths` to `[".", "ext"]` in your workspace settings: 22 | 23 | ```json 24 | { 25 | "d.projectImportPaths": [".", "ext"] 26 | } 27 | ``` 28 | 29 | ![project import paths](images/project_import_paths.png) 30 | 31 | By setting this all external dependencies specified will now load properly: 32 | 33 | ![working auto complete](images/all_srcs.png) 34 | 35 | ### Building 36 | 37 | If you have a very simple script without any extra dependencies outside the source folder itself, you can run each file using RDMD: 38 | 39 | ![run file with rdmd](images/run_with_rdmd.png) 40 | 41 | However this will not work in this case with extra custom dependencies if they are used as it will not pick them up for the imports. 42 | 43 | Otherwise you will have to define your own scripts or build tools and best integrate them in the [build task definitions](https://go.microsoft.com/fwlink/?LinkId=733558) so you can use them for [debugging](debugging.md). 44 | -------------------------------------------------------------------------------- /docs-src/vibe-d.md: -------------------------------------------------------------------------------- 1 | # Tutorial 2 | 3 | #menu 4 | 5 | ## vibe.d Web App 6 | 7 | ### Generating the Project 8 | 9 | Much like in the [Hello World example](hello-world.md) you first need to use the project generator to create a project. This time select `Basic Web Server` for a basic vibe.d web servers. 10 | 11 | ![create basic web server](images/create_vibed_project.png) 12 | 13 | You will find that several template files have been inserted in your project folder: 14 | 15 | ![file layout of basic vibe.d web server](images/create_vibed_project_files.png) 16 | 17 | In general: 18 | 19 | * `public/` contains all the HTTP-accessible static files such as images, stylesheets and scripts. 20 | * `source/` contains all the server-side D code 21 | * `views/` contains all the server-side templates for rendering into HTML 22 | 23 | ### Running the Web App 24 | 25 | Simply hit `Ctrl-Shift-B` to use the build tasks as described in the [Building](building.md) chapter and use the run option or simply enter `dub run` in the integrated terminal. 26 | 27 | ![dub run](images/tasks_run.png) 28 | 29 | The first time this will take a while to fetch and compile all dependencies, but successive runs will be faster. 30 | 31 | When now running the application, a web server will be opened which you can access locally: 32 | 33 | ![vibe.d console output](images/vibed_output.png) 34 | 35 | You can now open [http://127.0.0.1:3000/](http://127.0.0.1:3000/) in your browser to look at the example vibe.d app. 36 | 37 | ![vibe.d website](images/vibed_website.png) 38 | 39 | You can explore around in the source code and do modifications. Once done, close the server using `Ctrl-C` in the terminal and rebuild and start it again. 40 | 41 | ### Diet Template Files 42 | 43 | vibe.d uses a template format called [Diet](https://vibed.org/templates/diet) which is based off [pugjs](https://pugjs.org/api/getting-started.html). It is an indentation based language emitting HTML or XML code which can contain D code which is compiled in and run at runtime. 44 | 45 | See documentation: [diet reference](https://vibed.org/templates/diet) 46 | 47 | ```dt 48 | doctype html 49 | html 50 | head 51 | title My Website 52 | link(rel="stylesheet", href="/css/style.css") 53 | body 54 | h1 Hello World! 55 | p Edit 56 | code views/index.dt 57 | | to edit this template 58 | a(href="/api/users") Example REST API 59 | ``` 60 | 61 | code-d provides full auto completion support for HTML5 tags and attributes. Additionally it fully supports auto completing inline D code inside diet template files. 62 | 63 | -------------------------------------------------------------------------------- /docs/dub.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Tutorial 4 | 5 |
6 | 7 | * [Home](index.md) 8 | * [Installation](install.md) 9 | * [Tutorial](intro-to-d.md) 10 | * [Intro to D](intro-to-d.md) 11 | * [Hello World](hello-world.md) 12 | * [Building](building.md) 13 | * [Debugging](debugging.md) 14 | * [Editing](editing.md) 15 | * **[DUB Package Manager](dub.md)** 16 | * [vibe.d Web App](vibe-d.md) 17 | * [Configuring non-DUB projects](non-dub.md) 18 | * [Troubleshooting](troubleshooting.md) 19 | * [Changelog](../CHANGELOG.md) 20 | 21 |
22 | 23 | ## DUB Package Manager 24 | 25 | code-d offers full integration for the DUB package manager for all development purposes. This includes: 26 | 27 | - Full file support for dub.json and dub.sdl 28 | - Dependency management within VSCode 29 | - Add/Remove/Upgrade dependencies 30 | - Go to definition, auto complete, etc. 31 | - Building 32 | - Creation 33 | 34 | ### "DUB Dependencies" Panel 35 | 36 | The first entry point to the dub dependencies is the "DUB Dependencies" panel in the files list: 37 | 38 | ![dub dependencies panel](images/dub_panel.png) 39 | 40 | Using the first button dependencies can automatically be added to the dub package file in the project. 41 | 42 | ![add dub dependencies list](images/dub_dependency_list.png) 43 | 44 | Adding a dependency will automatically add it to the dub package file. 45 | 46 | To remove or update a dependency, right click it and select the desired option. 47 | 48 | When first adding a dependency it will be missing any version from the list: 49 | 50 | ![dub dependencies panel with missing dependency version](images/missing_dependency_version.png) 51 | 52 | This also means that auto completion and other features for this dependency won't work. To fix this, open the command line and enter 53 | 54 | ``` 55 | dub upgrade 56 | ``` 57 | 58 | to make dub download all dependencies. 59 | 60 | When done, press the reload button at the right to refresh the local dependencies. (subject to change) 61 | 62 | ![working dub dependencies panel](images/fixed_dependency_version.png) 63 | 64 | Any dependency in this tree can be expanded and collapsed. Additionally it is possible to click on the dependencies to view the locally installed README files: 65 | 66 | ![readme example of vibe.d](images/dub_panel_full.png) 67 | 68 | It will also show much of the other information which can be put into the dub package files. This panel gives a quick and easy overview over the complexity of all dependencies and access to so. Viewing the README files makes it easy to view example code given by the language authors. 69 | 70 | ### Editing 71 | 72 | ![dub.json file](images/dub_json_file.png) 73 | 74 | Here code-d adds 2 buttons at the top of the bar for easier manipulation: 75 | 76 | The left-most button "Convert between dub.json/dub.sdl" will rename and convert the file to the other available format by dub. 77 | 78 | ![dub.sdl file](images/dub_sdl_file.png) 79 | 80 | Be aware that this will remove all comments from a dub.sdl and unknown directives from a dub.json file and reset all indentation. 81 | 82 | The middle button "Open project settings" opens a (currently disfunctional) GUI editor for the dub.json file. Note this functionality is only currently implemented for dub.json and not dub.sdl 83 | 84 | Auto completion and inline hover documentation in this file will usually guide you through everything you need to know. Refer to the [official documentation](https://dub.pm/package-format-json) for details. 85 | 86 | ![example big dub.json file](images/dub_json_file_big.png) 87 | 88 | ### Building 89 | 90 | See [building](building.md) 91 | 92 | ### Next Steps 93 | 94 | Create a [web server with vibe.d](vibe-d.md) 95 | -------------------------------------------------------------------------------- /docs/hello-world.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Tutorial 4 | 5 |
6 | 7 | * [Home](index.md) 8 | * [Installation](install.md) 9 | * [Tutorial](intro-to-d.md) 10 | * [Intro to D](intro-to-d.md) 11 | * **[Hello World](hello-world.md)** 12 | * [Building](building.md) 13 | * [Debugging](debugging.md) 14 | * [Editing](editing.md) 15 | * [DUB Package Manager](dub.md) 16 | * [vibe.d Web App](vibe-d.md) 17 | * [Configuring non-DUB projects](non-dub.md) 18 | * [Troubleshooting](troubleshooting.md) 19 | * [Changelog](../CHANGELOG.md) 20 | 21 |
22 | 23 | ## Hello World 24 | 25 | ### Opening a Workspace 26 | 27 | code-d works best when folders are opened. 28 | 29 | For a simple project open a normal folder using the `Open Folder...` button. 30 | 31 | It's possible to add multiple folders to the workspace in VSCode using `File -> Add Folder to Workspace...`. 32 | 33 | Click `File -> Open Folder...` or `Ctrl-Shift-P -> Open Folder...` to open an empty folder as workspace for your project. 34 | 35 | ![example video](video_open_folder.gif) 36 | 37 | ### Working without workspace 38 | 39 | It is also possible to have projects with very few files and no dependencies whatsoever. For this you can also open a workspace as described above to have full feature access (such as build tasks and dependencies) but for quickly editing singular D files it is also possible to simply open them in VSCode. However auto completion is limited to only the standard library in this case, so it's not a good idea to work like this for bigger projects. 40 | 41 | ### Generating a Project using a Template 42 | 43 | code-d contains project templates to quick-start the creation of projects. 44 | 45 | Open an empty folder with the desired name for the project. 46 | 47 | Continue by opening the command palette (F1 or Ctrl-Shift-P) and run `code-d: Create new project`. Follow the wizard to create the project. 48 | 49 | ![example video](video_create_project.gif) 50 | 51 | ### Writing code 52 | 53 | You can now start coding away. To make this hello world project actually work, insert the following code: 54 | 55 | ```d 56 | import std.stdio; 57 | 58 | void main() 59 | { 60 | writeln("Hello World"); 61 | } 62 | ``` 63 | 64 | ### Things to note 65 | 66 | The example projects create a DUB project for you. (Noticable with the dub.json or dub.sdl file which is present at root level) 67 | 68 | This means you have access to the whole [D package registry](https://code.dlang.org) and can use DUB as build tool too. 69 | 70 | See [DUB homepage](https://dub.pm) for more information. 71 | 72 | ### Next Steps 73 | 74 | Next you might want to check out the chapter [Building](building.md) to see how you can now run your application. 75 | 76 | However if you don't want to use DUB for building and dependencies, check out [how to configure non-DUB projects](non-dub.md) 77 | 78 | You might also want to explore the [Editor Features](editing.md) code-d has to offer. 79 | -------------------------------------------------------------------------------- /docs/images/action_auto_import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/action_auto_import.png -------------------------------------------------------------------------------- /docs/images/action_implement_interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/action_implement_interface.png -------------------------------------------------------------------------------- /docs/images/all_srcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/all_srcs.png -------------------------------------------------------------------------------- /docs/images/breadcrumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/breadcrumb.png -------------------------------------------------------------------------------- /docs/images/build_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/build_arch.png -------------------------------------------------------------------------------- /docs/images/build_compiler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/build_compiler.png -------------------------------------------------------------------------------- /docs/images/build_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/build_configuration.png -------------------------------------------------------------------------------- /docs/images/build_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/build_list.png -------------------------------------------------------------------------------- /docs/images/build_run_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/build_run_output.png -------------------------------------------------------------------------------- /docs/images/build_types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/build_types.png -------------------------------------------------------------------------------- /docs/images/calltips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/calltips.png -------------------------------------------------------------------------------- /docs/images/code_dfmt_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/code_dfmt_off.png -------------------------------------------------------------------------------- /docs/images/code_formatted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/code_formatted.png -------------------------------------------------------------------------------- /docs/images/code_linting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/code_linting.png -------------------------------------------------------------------------------- /docs/images/code_unformatted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/code_unformatted.png -------------------------------------------------------------------------------- /docs/images/coverage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/coverage.png -------------------------------------------------------------------------------- /docs/images/coverage_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/coverage_bottom.png -------------------------------------------------------------------------------- /docs/images/create_vibed_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/create_vibed_project.png -------------------------------------------------------------------------------- /docs/images/create_vibed_project_files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/create_vibed_project_files.png -------------------------------------------------------------------------------- /docs/images/ddoc_complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/ddoc_complete.png -------------------------------------------------------------------------------- /docs/images/debug_existing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/debug_existing.png -------------------------------------------------------------------------------- /docs/images/debug_fresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/debug_fresh.png -------------------------------------------------------------------------------- /docs/images/debug_fresh2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/debug_fresh2.png -------------------------------------------------------------------------------- /docs/images/debug_status_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/debug_status_bar.png -------------------------------------------------------------------------------- /docs/images/default_srcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/default_srcs.png -------------------------------------------------------------------------------- /docs/images/dpldocs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dpldocs.png -------------------------------------------------------------------------------- /docs/images/dpldocs_context_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dpldocs_context_menu.png -------------------------------------------------------------------------------- /docs/images/dpldocs_site.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dpldocs_site.png -------------------------------------------------------------------------------- /docs/images/dub_dependency_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dub_dependency_list.png -------------------------------------------------------------------------------- /docs/images/dub_json_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dub_json_file.png -------------------------------------------------------------------------------- /docs/images/dub_json_file_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dub_json_file_big.png -------------------------------------------------------------------------------- /docs/images/dub_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dub_panel.png -------------------------------------------------------------------------------- /docs/images/dub_panel_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dub_panel_full.png -------------------------------------------------------------------------------- /docs/images/dub_sdl_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/dub_sdl_file.png -------------------------------------------------------------------------------- /docs/images/ext_code_lldb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/ext_code_lldb.png -------------------------------------------------------------------------------- /docs/images/ext_cpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/ext_cpp.png -------------------------------------------------------------------------------- /docs/images/ext_native_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/ext_native_debug.png -------------------------------------------------------------------------------- /docs/images/extension_installed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/extension_installed.png -------------------------------------------------------------------------------- /docs/images/fixed_dependency_version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/fixed_dependency_version.png -------------------------------------------------------------------------------- /docs/images/full_ddoc_complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/full_ddoc_complete.png -------------------------------------------------------------------------------- /docs/images/full_ddoc_complete_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/full_ddoc_complete_done.png -------------------------------------------------------------------------------- /docs/images/gc_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/gc_profile.png -------------------------------------------------------------------------------- /docs/images/import_timing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/import_timing.png -------------------------------------------------------------------------------- /docs/images/missing_auto_complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/missing_auto_complete.png -------------------------------------------------------------------------------- /docs/images/missing_dependency_version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/missing_dependency_version.png -------------------------------------------------------------------------------- /docs/images/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/outline.png -------------------------------------------------------------------------------- /docs/images/output_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/output_tab.png -------------------------------------------------------------------------------- /docs/images/output_tab_served_dropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/output_tab_served_dropdown.png -------------------------------------------------------------------------------- /docs/images/project_import_paths.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/project_import_paths.png -------------------------------------------------------------------------------- /docs/images/quick_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/quick_outline.png -------------------------------------------------------------------------------- /docs/images/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/reload.png -------------------------------------------------------------------------------- /docs/images/run_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/run_task.png -------------------------------------------------------------------------------- /docs/images/run_with_rdmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/run_with_rdmd.png -------------------------------------------------------------------------------- /docs/images/sorted_imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/sorted_imports.png -------------------------------------------------------------------------------- /docs/images/sponsor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/sponsor.png -------------------------------------------------------------------------------- /docs/images/task_configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/task_configure.png -------------------------------------------------------------------------------- /docs/images/task_configure_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/task_configure_list.png -------------------------------------------------------------------------------- /docs/images/task_generated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/task_generated.png -------------------------------------------------------------------------------- /docs/images/tasks_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/tasks_run.png -------------------------------------------------------------------------------- /docs/images/unsorted_imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/unsorted_imports.png -------------------------------------------------------------------------------- /docs/images/verbose_config_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/verbose_config_key.png -------------------------------------------------------------------------------- /docs/images/verbose_output_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/verbose_output_tab.png -------------------------------------------------------------------------------- /docs/images/vibed_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/vibed_output.png -------------------------------------------------------------------------------- /docs/images/vibed_website.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/vibed_website.png -------------------------------------------------------------------------------- /docs/images/vscode_reload_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/vscode_reload_button.png -------------------------------------------------------------------------------- /docs/images/workspace_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/images/workspace_outline.png -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

code-d User Guide

4 | 5 | Welcome! Thank you for installing code-d. 6 | 7 | This document describes how you can effectively use code-d and D in Visual Studio Code from the ground up. 8 | 9 | **To open this at any later point, run `Ctrl-Shift-P -> code-d: Open User Guide / Documentation`** 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 31 | 42 | 43 |
Join the ChatDonate
20 | 21 | [![Join on Discord](https://discordapp.com/api/guilds/242094594181955585/widget.png?style=shield)](https://discord.gg/Bstj9bx) 22 | 23 | Discord chat 24 |
25 |
26 | Development 27 |
28 | & Support 29 | 30 |
32 | 33 | [![Sponsor me on GitHub Sponsors](images/sponsor.png)](https://github.com/sponsors/WebFreak001) 34 | 35 | Donate for faster 36 |
37 | development on 38 |
39 | code-d and serve-d 40 | 41 |
44 | Click a link below to open pages about certain topics. 45 | 46 | 47 | 48 | * [Home](index.md) 49 | 50 | * [Installation](install.md) 51 | 52 | * [Tutorial](intro-to-d.md) 53 | 54 | * [Intro to D](intro-to-d.md) 55 | 56 | * [Hello World](hello-world.md) 57 | 58 | * [Building](building.md) 59 | 60 | * [Debugging](debugging.md) 61 | 62 | * [Editing](editing.md) 63 | 64 | * [DUB Package Manager](dub.md) 65 | 66 | * [vibe.d Web App](vibe-d.md) 67 | 68 | * [Configuring non-DUB projects](non-dub.md) 69 | 70 | * [Troubleshooting](troubleshooting.md) 71 | 72 | * [Changelog](../CHANGELOG.md) 73 | 74 | --- 75 | 76 | **GitHub**: 77 | 78 | **Plugin**: https://github.com/Pure-D/code-d 79 | 80 | **Language Features**: https://github.com/Pure-D/serve-d 81 | -------------------------------------------------------------------------------- /docs/install.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Installation 4 | 5 |
6 | 7 | * [Home](index.md) 8 | * **[Installation](install.md)** 9 | * [Tutorial](intro-to-d.md) 10 | * [Intro to D](intro-to-d.md) 11 | * [Hello World](hello-world.md) 12 | * [Building](building.md) 13 | * [Debugging](debugging.md) 14 | * [Editing](editing.md) 15 | * [DUB Package Manager](dub.md) 16 | * [vibe.d Web App](vibe-d.md) 17 | * [Configuring non-DUB projects](non-dub.md) 18 | * [Troubleshooting](troubleshooting.md) 19 | * [Changelog](../CHANGELOG.md) 20 | 21 |
22 | 23 | First you have to install code-d in VSCode like any other extension from the side panel in VSCode. 24 | 25 | It's possible to manually download the vsix for manual installation from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=webfreak.code-d) or the [Open VSX Registry](https://open-vsx.org/extension/webfreak/code-d). 26 | 27 | ## First time installing D 28 | 29 | If you don't have D installed, code-d will open the [D compiler download page](https://dlang.org/download.html) for you where you simply select your compiler of choice and install it for your OS. 30 | 31 | On Windows it's a good idea to restart your PC after D is installed so it is accessible from PATH from within VSCode and its extensions. 32 | 33 | After D has been installed, restart VSCode and open a D project, everything should work now. 34 | 35 | ## Verifying functionality 36 | 37 | First open a folder with a D project or a blank one to create a project in. With a folder opened, simply open any D file and then in the bottom panels, check the **Output** tab. 38 | 39 | ![output tab to check](images/output_tab.png) 40 | 41 | In here at the right you should see a drop-down menu. If you can see `code-d & serve-d` in this then it means the extension is working and running. 42 | 43 | ![serve-d in the output panel drop down](images/output_tab_served_dropdown.png) 44 | 45 | If you experience any issues, check this tab for possible errors and log for debugging purposes when submitting an issue. 46 | 47 | For more information in case something doesn't work, refer to [Troubleshooting](troubleshooting.md). 48 | 49 | ## First steps 50 | 51 | [Tutorial](intro-to-d.md) 52 | -------------------------------------------------------------------------------- /docs/intro-to-d.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Tutorial 4 | 5 |
6 | 7 | * [Home](index.md) 8 | * [Installation](install.md) 9 | * **[Tutorial](intro-to-d.md)** 10 | * **[Intro to D](intro-to-d.md)** 11 | * [Hello World](hello-world.md) 12 | * [Building](building.md) 13 | * [Debugging](debugging.md) 14 | * [Editing](editing.md) 15 | * [DUB Package Manager](dub.md) 16 | * [vibe.d Web App](vibe-d.md) 17 | * [Configuring non-DUB projects](non-dub.md) 18 | * [Troubleshooting](troubleshooting.md) 19 | * [Changelog](../CHANGELOG.md) 20 | 21 |
22 | 23 | ## Intro to D 24 | 25 | D is a general-purpose programming language with static typing, systems-level access, and C-like syntax. 26 | 27 | There are great resources online to learn D. Check out the following selection for high quality beginner-friendly D tutorials: 28 | 29 | - [Language Reference](https://dlang.org/spec/spec.html) (official reference) 30 | 31 | Exhaustive list of all grammatical constructs in the language in easy to read language. Great for people with some previous experience in programming. 32 | 33 | Must-read at some point when programming in D. 34 | 35 | - [DLang Tour](https://tour.dlang.org/) (community-maintained) 36 | 37 | Multi language, extensive tutorial page covering a lot of basics for people with some previous experience in programming. Covers multiple topics and standard library and is a great place to check out. 38 | 39 | - [Programming in D](http://ddili.org/ders/d.en/) 40 | 41 | Great book about D. Available in English or Turkish and as Paper Book, e-Book and online website. Although having experience in other programming languages is certainly helpful, this book starts from the basics. 42 | 43 | ## Community Support 44 | 45 | - [D Forum Learn Group](https://forum.dlang.org/group/learn) 46 | 47 | Great place to ask complex questions and get the most feedback. Available online or as mailing list. 48 | 49 | - [StackOverflow](https://stackoverflow.com/) 50 | 51 | Use the `d` tag for D questions, perfect to ask general questions when there isn't anything online. 52 | 53 | - [D Language Code Club (discord)](https://discord.gg/Bstj9bx) 54 | 55 | Official Discord chat of the code-d extension. Active and fast community support for most of the day and also support for code-d issues. More links for D resources here too. 56 | 57 | ## Next Steps 58 | 59 | Start writing a [Hello World](hello-world.md) project. 60 | -------------------------------------------------------------------------------- /docs/non-dub.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Tutorial 4 | 5 |
6 | 7 | * [Home](index.md) 8 | * [Installation](install.md) 9 | * [Tutorial](intro-to-d.md) 10 | * [Intro to D](intro-to-d.md) 11 | * [Hello World](hello-world.md) 12 | * [Building](building.md) 13 | * [Debugging](debugging.md) 14 | * [Editing](editing.md) 15 | * [DUB Package Manager](dub.md) 16 | * [vibe.d Web App](vibe-d.md) 17 | * **[Configuring non-DUB projects](non-dub.md)** 18 | * [Troubleshooting](troubleshooting.md) 19 | * [Changelog](../CHANGELOG.md) 20 | 21 |
22 | 23 | ## Configuring non-DUB projects 24 | 25 | By default code-d loads the project folder itself and then each dub project in child folders as separate root. 26 | 27 | Without dub by default it will only load the project folder itself as root but it's possible to specify multiple roots in one folder for multiple projects in one folder. For this, specify `d.extraRoots` in your workspace settings with relative paths to each folder that is supposed to be treated as separate project. 28 | 29 | In each root code-d checks if one of the following folders exist if there is no dub and the `d.projectImportPaths` user setting is not set: 30 | - `source/` 31 | - `src/` 32 | 33 | The first one off that list is going to be picked as source directory for that root. If none of those exist, the folder itself is going to be used as directory for sources. By specifying `d.projectImportPaths` it is possible to override this behavior to use a custom defined source folder path. All paths in `d.projectImportPaths` are relative to the project folder and all roots will have the same import paths with this. 34 | 35 | ![example showing root source files](images/default_srcs.png) 36 | 37 | You can see that imports from local files are auto-completed with no problems. However when trying to use files from external folders (such as here, the `ext/` folder) the auto completion will not find these symbols. 38 | 39 | To fix this, change `d.projectImportPaths` to `[".", "ext"]` in your workspace settings: 40 | 41 | ```json 42 | { 43 | "d.projectImportPaths": [".", "ext"] 44 | } 45 | ``` 46 | 47 | ![project import paths](images/project_import_paths.png) 48 | 49 | By setting this all external dependencies specified will now load properly: 50 | 51 | ![working auto complete](images/all_srcs.png) 52 | 53 | ### Building 54 | 55 | If you have a very simple script without any extra dependencies outside the source folder itself, you can run each file using RDMD: 56 | 57 | ![run file with rdmd](images/run_with_rdmd.png) 58 | 59 | However this will not work in this case with extra custom dependencies if they are used as it will not pick them up for the imports. 60 | 61 | Otherwise you will have to define your own scripts or build tools and best integrate them in the [build task definitions](https://go.microsoft.com/fwlink/?LinkId=733558) so you can use them for [debugging](debugging.md). 62 | -------------------------------------------------------------------------------- /docs/tutorial.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/vibe-d.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Tutorial 4 | 5 |
6 | 7 | * [Home](index.md) 8 | * [Installation](install.md) 9 | * [Tutorial](intro-to-d.md) 10 | * [Intro to D](intro-to-d.md) 11 | * [Hello World](hello-world.md) 12 | * [Building](building.md) 13 | * [Debugging](debugging.md) 14 | * [Editing](editing.md) 15 | * [DUB Package Manager](dub.md) 16 | * **[vibe.d Web App](vibe-d.md)** 17 | * [Configuring non-DUB projects](non-dub.md) 18 | * [Troubleshooting](troubleshooting.md) 19 | * [Changelog](../CHANGELOG.md) 20 | 21 |
22 | 23 | ## vibe.d Web App 24 | 25 | ### Generating the Project 26 | 27 | Much like in the [Hello World example](hello-world.md) you first need to use the project generator to create a project. This time select `Basic Web Server` for a basic vibe.d web servers. 28 | 29 | ![create basic web server](images/create_vibed_project.png) 30 | 31 | You will find that several template files have been inserted in your project folder: 32 | 33 | ![file layout of basic vibe.d web server](images/create_vibed_project_files.png) 34 | 35 | In general: 36 | 37 | * `public/` contains all the HTTP-accessible static files such as images, stylesheets and scripts. 38 | * `source/` contains all the server-side D code 39 | * `views/` contains all the server-side templates for rendering into HTML 40 | 41 | ### Running the Web App 42 | 43 | Simply hit `Ctrl-Shift-B` to use the build tasks as described in the [Building](building.md) chapter and use the run option or simply enter `dub run` in the integrated terminal. 44 | 45 | ![dub run](images/tasks_run.png) 46 | 47 | The first time this will take a while to fetch and compile all dependencies, but successive runs will be faster. 48 | 49 | When now running the application, a web server will be opened which you can access locally: 50 | 51 | ![vibe.d console output](images/vibed_output.png) 52 | 53 | You can now open [http://127.0.0.1:3000/](http://127.0.0.1:3000/) in your browser to look at the example vibe.d app. 54 | 55 | ![vibe.d website](images/vibed_website.png) 56 | 57 | You can explore around in the source code and do modifications. Once done, close the server using `Ctrl-C` in the terminal and rebuild and start it again. 58 | 59 | ### Diet Template Files 60 | 61 | vibe.d uses a template format called [Diet](https://vibed.org/templates/diet) which is based off [pugjs](https://pugjs.org/api/getting-started.html). It is an indentation based language emitting HTML or XML code which can contain D code which is compiled in and run at runtime. 62 | 63 | See documentation: [diet reference](https://vibed.org/templates/diet) 64 | 65 | ```dt 66 | doctype html 67 | html 68 | head 69 | title My Website 70 | link(rel="stylesheet", href="/css/style.css") 71 | body 72 | h1 Hello World! 73 | p Edit 74 | code views/index.dt 75 | | to edit this template 76 | a(href="/api/users") Example REST API 77 | ``` 78 | 79 | code-d provides full auto completion support for HTML5 tags and attributes. Additionally it fully supports auto completing inline D code inside diet template files. 80 | 81 | -------------------------------------------------------------------------------- /docs/video_create_project.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/video_create_project.gif -------------------------------------------------------------------------------- /docs/video_create_project.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/video_create_project.mp4 -------------------------------------------------------------------------------- /docs/video_open_folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/video_open_folder.gif -------------------------------------------------------------------------------- /docs/video_open_folder.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/video_open_folder.mp4 -------------------------------------------------------------------------------- /docs/video_snippets.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/video_snippets.gif -------------------------------------------------------------------------------- /docs/video_snippets.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/docs/video_snippets.mp4 -------------------------------------------------------------------------------- /html/dubeditor.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-left: 0; 3 | padding-right: 0; 4 | display: flex; 5 | flex-direction: column; 6 | min-height: 100vh; 7 | } 8 | 9 | .configurationbar { 10 | background-color: var(--vscode-editorWidget-background); 11 | color: var(--vscode-editorWidget-foreground); 12 | display: block; 13 | min-height: 1.5em; 14 | line-height: 1.5em; 15 | padding: 4px; 16 | padding-left: 16px; 17 | } 18 | 19 | .configurationbar label { 20 | line-height: calc(var(--input-height) * 1px); 21 | white-space: nowrap; 22 | margin: 4px; 23 | } 24 | 25 | #overrides { 26 | min-width: 150px; 27 | } 28 | 29 | .hsplit { 30 | display: flex; 31 | flex-grow: 1; 32 | } 33 | 34 | .hsplit .master { 35 | background-color: var(--vscode-sideBar-background); 36 | border-right: var(--vscode-sideBar-border); 37 | float: left; 38 | width: 200px; 39 | box-sizing: border-box; 40 | margin: 0; 41 | padding: 0; 42 | list-style: none; 43 | } 44 | 45 | .hsplit .master li { 46 | margin: 0; 47 | padding: 8px; 48 | padding-left: 20px; 49 | list-style: none; 50 | cursor: pointer; 51 | } 52 | 53 | .hsplit .master li.active { 54 | background-color: var(--vscode-list-activeSelectionBackground); 55 | color: var(--vscode-list-activeSelectionForeground); 56 | } 57 | 58 | .hsplit .master li:hover:not(.active) { 59 | background-color: var(--vscode-list-hoverBackground); 60 | } 61 | 62 | .vscode-high-contrast .hsplit .master li.active { 63 | background-color: white; 64 | color: black; 65 | } 66 | 67 | .hsplit .child { 68 | float: left; 69 | width: calc(100% - 200px); 70 | box-sizing: border-box; 71 | display: none; 72 | margin: 0; 73 | padding: 8px; 74 | } 75 | 76 | .hsplit .child.visible { 77 | display: block; 78 | } 79 | 80 | .clear { 81 | clear: both; 82 | } 83 | 84 | table#dependencies tr td:nth-child(1) { 85 | text-align: right; 86 | } 87 | 88 | vscode-button.reset-btn { 89 | position: absolute; 90 | display: inline-block; 91 | width: 2em; 92 | } 93 | 94 | .modified-hint { 95 | font-style: italic; 96 | opacity: 0.7; 97 | } 98 | 99 | .modified-hint:before { 100 | content: " ("; 101 | display: inline; 102 | } 103 | .modified-hint:after { 104 | content: ")"; 105 | display: inline; 106 | } 107 | 108 | .label { 109 | font-size: 0.9em; 110 | display: block; 111 | margin: 8px; 112 | box-sizing: border-box; 113 | max-width: 400px; 114 | } 115 | 116 | .label.lite { 117 | margin: 0; 118 | } 119 | 120 | .labelcb { 121 | display: block; 122 | margin: 8px; 123 | box-sizing: border-box; 124 | } 125 | 126 | .label > input, 127 | .label > textarea, 128 | .label > select { 129 | display: block; 130 | } 131 | 132 | .label > * { 133 | width: 100%; 134 | } 135 | 136 | .label > .description { 137 | margin-top: 0; 138 | font-size: 0.9em; 139 | opacity: 0.8; 140 | } 141 | 142 | #filedialog { 143 | position: fixed; 144 | left: 0; 145 | right: 0; 146 | top: 0; 147 | bottom: 0; 148 | padding: 16px; 149 | margin: auto; 150 | width: 300px; 151 | height: 200px; 152 | } 153 | 154 | #filedialog .content { 155 | padding: 8px; 156 | } 157 | 158 | #filedialog .content .label, 159 | #filedialog .content .labelcb { 160 | margin: 0; 161 | margin-bottom: 8px; 162 | } 163 | 164 | #filedialog .buttons { 165 | position: absolute; 166 | left: 0; 167 | bottom: 0; 168 | right: 0; 169 | width: 100%; 170 | height: 48px; 171 | padding: 8px 0; 172 | box-sizing: border-box; 173 | } 174 | 175 | #filedialog .buttons button { 176 | box-sizing: border-box; 177 | height: 32px; 178 | float: right; 179 | margin-right: 8px; 180 | } 181 | 182 | input, textarea { 183 | font-family: monospace; 184 | } 185 | 186 | .complex-setting vscode-data-grid-row vscode-data-grid-cell:not(:first-child) { 187 | text-align: center; 188 | } 189 | 190 | .complex-setting + .add { 191 | width: unset; 192 | --button-padding-vertical: 2px; 193 | --button-padding-horizontal: 12px; 194 | margin-bottom: 1ex; 195 | } 196 | -------------------------------------------------------------------------------- /images/adddep-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/adddep-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/authors-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/authors-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/dependency-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/dependency-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/description-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/description-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/dlogo-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/dlogo-square.png -------------------------------------------------------------------------------- /images/dlogo-square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /images/dub-convert-inverse.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/dub-convert.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/edit-dub-inverse.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/edit-dub.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/edit-source-inverse.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 40 | 43 | 44 | 46 | 47 | 49 | image/svg+xml 50 | 52 | 53 | 54 | 55 | 56 | 61 | 68 | 75 | 80 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /images/edit-source.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 40 | 43 | 44 | 46 | 47 | 49 | image/svg+xml 50 | 52 | 53 | 54 | 55 | 56 | 61 | 68 | 75 | 80 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /images/github/ddoc_new_writeln.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/github/ddoc_new_writeln.png -------------------------------------------------------------------------------- /images/github/dfmt_argument_translation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/github/dfmt_argument_translation.png -------------------------------------------------------------------------------- /images/license-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/license-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/refresh-dark.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/refresh-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/sponsor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/sponsor.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step1.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step2.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step3.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step4.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step5.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step6.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step7.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step8.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/step9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/step9.png -------------------------------------------------------------------------------- /images/tutorial/project-creation/stepA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/images/tutorial/project-creation/stepA.png -------------------------------------------------------------------------------- /lang-configs/d.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "blockComment": [ 4 | "/*", 5 | "*/" 6 | ], 7 | "lineComment": "//" 8 | }, 9 | "brackets": [ 10 | [ 11 | "(", 12 | ")" 13 | ], 14 | [ 15 | "{", 16 | "}" 17 | ], 18 | [ 19 | "[", 20 | "]" 21 | ] 22 | ], 23 | "autoClosingPairs": [ 24 | [ 25 | "{", 26 | "}" 27 | ], 28 | [ 29 | "[", 30 | "]" 31 | ], 32 | [ 33 | "(", 34 | ")" 35 | ], 36 | { 37 | "open": "`", 38 | "close": "`", 39 | "notIn": [ 40 | "string" 41 | ] 42 | }, 43 | { 44 | "open": "\"", 45 | "close": "\"", 46 | "notIn": [ 47 | "string" 48 | ] 49 | }, 50 | { 51 | "open": "'", 52 | "close": "'", 53 | "notIn": [ 54 | "string" 55 | ] 56 | } 57 | ], 58 | "surroundingPairs": [ 59 | [ 60 | "{", 61 | "}" 62 | ], 63 | [ 64 | "[", 65 | "]" 66 | ], 67 | [ 68 | "(", 69 | ")" 70 | ], 71 | [ 72 | "'", 73 | "'" 74 | ], 75 | [ 76 | "\"", 77 | "\"" 78 | ], 79 | [ 80 | "`", 81 | "`" 82 | ] 83 | ], 84 | "folding": { 85 | "markers": { 86 | "start": "^\\s*//\\s*dfmt\\s*off", 87 | "end": "^\\s*//\\s*dfmt\\s*on" 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /lang-configs/diet.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//" 4 | }, 5 | "brackets": [ 6 | [ 7 | "(", 8 | ")" 9 | ], 10 | [ 11 | "{", 12 | "}" 13 | ], 14 | [ 15 | "[", 16 | "]" 17 | ] 18 | ], 19 | "autoClosingPairs": [ 20 | [ 21 | "{", 22 | "}" 23 | ], 24 | [ 25 | "[", 26 | "]" 27 | ], 28 | [ 29 | "(", 30 | ")" 31 | ], 32 | { 33 | "open": "<", 34 | "close": ">", 35 | "notIn": [ 36 | "embedded", 37 | "string" 38 | ] 39 | }, 40 | { 41 | "open": "`", 42 | "close": "`", 43 | "notIn": [ 44 | "string" 45 | ] 46 | }, 47 | { 48 | "open": "\"", 49 | "close": "\"", 50 | "notIn": [ 51 | "string" 52 | ] 53 | }, 54 | { 55 | "open": "'", 56 | "close": "'", 57 | "notIn": [ 58 | "string" 59 | ] 60 | } 61 | ], 62 | "surroundingPairs": [ 63 | [ 64 | "{", 65 | "}" 66 | ], 67 | [ 68 | "[", 69 | "]" 70 | ], 71 | [ 72 | "(", 73 | ")" 74 | ], 75 | [ 76 | "'", 77 | "'" 78 | ], 79 | [ 80 | "\"", 81 | "\"" 82 | ], 83 | [ 84 | "`", 85 | "`" 86 | ] 87 | ], 88 | "folding": { 89 | "offSide": true 90 | }, 91 | "wordPattern": "[^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+" 92 | } -------------------------------------------------------------------------------- /lang-configs/general.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "blockComment": [ 4 | "/*", 5 | "*/" 6 | ], 7 | "lineComment": "//" 8 | }, 9 | "brackets": [ 10 | [ 11 | "(", 12 | ")" 13 | ], 14 | [ 15 | "{", 16 | "}" 17 | ], 18 | [ 19 | "[", 20 | "]" 21 | ] 22 | ], 23 | "autoClosingPairs": [ 24 | [ 25 | "{", 26 | "}" 27 | ], 28 | [ 29 | "[", 30 | "]" 31 | ], 32 | [ 33 | "(", 34 | ")" 35 | ], 36 | { 37 | "open": "`", 38 | "close": "`", 39 | "notIn": [ 40 | "string" 41 | ] 42 | }, 43 | { 44 | "open": "\"", 45 | "close": "\"", 46 | "notIn": [ 47 | "string" 48 | ] 49 | }, 50 | { 51 | "open": "'", 52 | "close": "'", 53 | "notIn": [ 54 | "string" 55 | ] 56 | } 57 | ], 58 | "surroundingPairs": [ 59 | [ 60 | "{", 61 | "}" 62 | ], 63 | [ 64 | "[", 65 | "]" 66 | ], 67 | [ 68 | "(", 69 | ")" 70 | ], 71 | [ 72 | "'", 73 | "'" 74 | ], 75 | [ 76 | "\"", 77 | "\"" 78 | ], 79 | [ 80 | "`", 81 | "`" 82 | ] 83 | ] 84 | } -------------------------------------------------------------------------------- /res/images/create-launch-json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/res/images/create-launch-json.png -------------------------------------------------------------------------------- /res/walkthroughs/debugProject.md: -------------------------------------------------------------------------------- 1 | # Debugging Projects 2 | 3 | First install at least one of these 3 debugging extensions from the VSCode marketplace: 4 | 5 | - C++ 6 | - CodeLLDB 7 | - Native Debug 8 | 9 | Check out the Debugging section in the User Guide for more details about these and which to pick if you are unsure. 10 | 11 | First create a launch.json file: 12 | 13 | ![Create a launch.json using the sidebar](../images/create-launch-json.png) 14 | 15 | Then follow up by selecting either 16 | 17 | * D (code-d: Native Debug / C++ / CodeLLDB) 18 | * DUB (code-d: Native Debug / C++ / CodeLLDB) 19 | 20 | Selecting the `D` variant will just run some D executable you have built before. 21 | 22 | Selecting the `DUB` variant will build the project using DUB before running the 23 | configured executable. 24 | 25 | Now you can review the settings that were auto generated and you should be able 26 | to hit the start button to start debugging. 27 | -------------------------------------------------------------------------------- /res/walkthroughs/installCompiler.md: -------------------------------------------------------------------------------- 1 | # Installing a D Compiler 2 | 3 | To run D code you first need to build it. To build it a compiler must be 4 | installed on the system. 5 | 6 | There are several D compilers to choose from, you can find a list of them under 7 | https://dlang.org/download.html 8 | 9 | ## DMD 10 | 11 | DMD is the official reference compiler for D. It always implements the latest 12 | features and the latest standard library + runtime. Additionally it is the 13 | fastest compiler out of the 3, although it doesn't produce the fastest 14 | executables. It's a good compiler for prototyping and quick scripts and is the 15 | recommended compiler to get if you don't know which one to get. 16 | 17 | Download: https://dlang.org/download.html#dmd 18 | 19 | ## LDC 20 | 21 | LDC is an LLVM-based (like clang) D compiler. It supports a variety of operating 22 | systems and target architectures and has very frequent releases, usually being 23 | up-to-date to the DMD reference compiler within days. It takes longer to compile 24 | executables but results in much better optimized executables than with DMD. LDC 25 | is a good compiler to be using in production to create executables. 26 | 27 | Installation (package manager): https://github.com/ldc-developers/ldc#installation 28 | 29 | Download (executables): https://github.com/ldc-developers/ldc/releases 30 | 31 | ## GDC 32 | 33 | GDC is a GCC-based D compiler. Other than the other compilers, it comes built-in 34 | with GCC and does not require a separate installation. It supports a variety of 35 | operating systems and target architectures. Being tied to GCC's release schedule 36 | it may be behind in new D features. However GDC backports D bug fixes from later 37 | versions in minor updates. GDC could be called the most stable compiler as it is 38 | tied to specific D frontend versions for a while, only fixing issues without big 39 | changes. GDC is a good compiler to be using in production to create executables. 40 | 41 | GDC is included in GCC since GCC 9.0, installing a recent GCC version should 42 | have it included by default. 43 | 44 | For Linux distributions packaging the backends in different packages or Windows 45 | downloads see https://www.gdcproject.org/downloads 46 | 47 | --- 48 | 49 | The installation packages of DMD and LDC come with various utilities (DUB, rdmd) 50 | installed. If you don't have these utilities because you used your Operating 51 | System's package manager or installed GDC, code-d will download the executables. 52 | -------------------------------------------------------------------------------- /res/walkthroughs/userSettings.md: -------------------------------------------------------------------------------- 1 | # Configuring Code-D 2 | 3 | Code-D uses the standard VSCode user settings. Open the user settings and check 4 | out the section `Extensions > D` to view or edit all the settings. 5 | 6 | In the JSON settings editor the settings all start with `"d."` for D related 7 | settings, `"dfmt."` for formatter related settings and `"dscanner."` for linting 8 | related settings. 9 | 10 | Some features are disabled by default because they are not fully ready for all 11 | use-cases yet or may significantly increase resource usage on low-spec machines. 12 | If you want to, do give these features a try and report issues on 13 | [GitHub](https://github.com/Pure-D/code-d/issues). 14 | 15 | Code-D is using a language server protocol called Serve-D to implement all of 16 | its features. Serve-D gets more frequent updates than Code-D and these will 17 | automatically be downloaded whenever a new stable release gets released. If you 18 | don't want to receive automatic updates or want to receive more frequent beta or 19 | nightly updates, configure the `d.servedReleaseChannel` user setting to your 20 | liking and reload the window. 21 | -------------------------------------------------------------------------------- /snippets/diet.json: -------------------------------------------------------------------------------- 1 | { 2 | "html document": { 3 | "prefix": "html", 4 | "body": [ 5 | "doctype html", 6 | "", 7 | "html(lang=\"en\")", 8 | "\thead", 9 | "\t\tmeta(charset=\"UTF-8\")", 10 | "\t\tmeta(name=\"viewport\", content=\"width=device-width, initial-scale=1.0\")", 11 | "\t\tmeta(http-equiv=\"X-UA-Compatible\", content=\"ie=edge\")", 12 | "\t\ttitle ${1:Document}", 13 | "\tbody", 14 | "\t\t$2" 15 | ], 16 | "description": "Snippet emmet emulation for diet" 17 | }, 18 | "atom link": { 19 | "prefix": "link:atom", 20 | "body": "link(rel=\"alternate\", href=\"${1:atom.xml}\", type=\"application/atom+xml\", title=\"Atom\")", 21 | "description": "Snippet emmet emulation for diet" 22 | }, 23 | "css link": { 24 | "prefix": "link:css", 25 | "body": "link(rel=\"stylesheet\", href=\"${1:style}.css\")", 26 | "description": "Snippet emmet emulation for diet" 27 | }, 28 | "favicon link": { 29 | "prefix": "link:favicon", 30 | "body": "link(rel=\"shortcut icon\", href=\"${1:favicon.ico}\", type=\"image/x-icon\")", 31 | "description": "Snippet emmet emulation for diet" 32 | }, 33 | "import link": { 34 | "prefix": "link:import", 35 | "body": "link(rel=\"import\", href=\"${1:component.html}\")", 36 | "description": "Snippet emmet emulation for diet" 37 | }, 38 | "manifest link": { 39 | "prefix": "link:manifest", 40 | "body": "link(rel=\"manifest\", href=\"${1:manifest.json}\")", 41 | "description": "Snippet emmet emulation for diet" 42 | }, 43 | "print link": { 44 | "prefix": "link:print", 45 | "body": "link(rel=\"stylesheet\", href=\"${1:print}.css\", media=\"print\")", 46 | "description": "Snippet emmet emulation for diet" 47 | }, 48 | "rss link": { 49 | "prefix": "link:rss", 50 | "body": "link(rel=\"alternate\", href=\"${1:rss.xml}\", type=\"application/rss+xml\", title=\"RSS\")", 51 | "description": "Snippet emmet emulation for diet" 52 | }, 53 | "touch icon link": { 54 | "prefix": "link:touch", 55 | "body": "link(rel=\"apple-touch-icon\", href=\"favicon.png\")", 56 | "description": "Snippet emmet emulation for diet" 57 | }, 58 | "script src": { 59 | "prefix": "script:src", 60 | "body": "script(src=\"$1\")", 61 | "description": "Snippet emmet emulation for diet" 62 | }, 63 | "style": { 64 | "prefix": "style", 65 | "body": [ 66 | ":css", 67 | "\t" 68 | ], 69 | "description": "Snippet emmet emulation for diet" 70 | }, 71 | "script": { 72 | "prefix": "script", 73 | "body": [ 74 | ":javascript", 75 | "\t" 76 | ], 77 | "description": "Snippet emmet emulation for diet" 78 | }, 79 | "markdown": { 80 | "prefix": "markdown", 81 | "body": [ 82 | ":markdown", 83 | "\t" 84 | ], 85 | "description": "Snippet emmet emulation for diet" 86 | } 87 | } -------------------------------------------------------------------------------- /sponsors/weka.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/sponsors/weka.png -------------------------------------------------------------------------------- /src/api_impl.ts: -------------------------------------------------------------------------------- 1 | import { DScannerIniSection, ServeD } from "./extension"; 2 | import { CodedAPI, Snippet } from "code-d-api"; 3 | import * as vscode from "vscode"; 4 | 5 | /** 6 | * Implementation of the code-d API using serve-d 7 | */ 8 | export class CodedAPIServedImpl implements CodedAPI { 9 | protected served?: ServeD; 10 | 11 | protected dependencySnippetsToRegister: [string[], Snippet][] = []; 12 | registerDependencyBasedSnippet(requiredDependencies: string[], snippet: Snippet): void { 13 | this.dependencySnippetsToRegister.push([requiredDependencies, snippet]); 14 | 15 | this.served?.addDependencySnippet({ 16 | requiredDependencies: requiredDependencies, 17 | snippet: snippet 18 | }); 19 | } 20 | 21 | registerDependencyBasedSnippets(requiredDependencies: string[], snippets: Snippet[]): void { 22 | snippets.forEach(snippet => { 23 | this.registerDependencyBasedSnippet(requiredDependencies, snippet); 24 | }); 25 | } 26 | 27 | refreshDependencies(): boolean { 28 | if (this.served) { 29 | this.served.refreshDependencies(); 30 | return true; 31 | } else { 32 | return false; 33 | } 34 | } 35 | 36 | triggerDscanner(uri: string | vscode.Uri): boolean { 37 | if (this.served) { 38 | if (typeof uri == "string") 39 | uri = vscode.Uri.parse(uri); 40 | 41 | this.served.triggerDscanner(uri); 42 | return true; 43 | } else { 44 | return false; 45 | } 46 | } 47 | 48 | async listDscannerConfig(uri: string | vscode.Uri): Promise { 49 | if (typeof uri == "string") 50 | uri = vscode.Uri.parse(uri); 51 | 52 | const served = await this.waitForInternalImplementation(); 53 | return await served.listDScannerConfig(uri); 54 | } 55 | 56 | async findFiles(query: string): Promise { 57 | const served = await this.waitForInternalImplementation(); 58 | return await served.findFiles(query); 59 | } 60 | 61 | async findFilesByModule(query: string): Promise { 62 | const served = await this.waitForInternalImplementation(); 63 | return await served.findFilesByModule(query); 64 | } 65 | 66 | async getActiveDubConfig(): Promise<{ packagePath: string, packageName: string, [unstableExtras: string]: any }> { 67 | const served = await this.waitForInternalImplementation(); 68 | return await served.getActiveDubConfig(); 69 | } 70 | 71 | get isActive(): boolean { 72 | return !!this.served; 73 | } 74 | 75 | // ------------------------------------------------------------------------ 76 | // Implementation details starting here, no stable API 77 | // ------------------------------------------------------------------------ 78 | 79 | private _onInternalImplementationReady: vscode.EventEmitter = new vscode.EventEmitter(); 80 | readonly onInternalImplementationReady: vscode.Event = this._onInternalImplementationReady.event; 81 | 82 | started(served: ServeD) { 83 | this.served = served; 84 | let promises: Thenable[] = []; 85 | this.dependencySnippetsToRegister.forEach(snip => { 86 | promises.push(served.addDependencySnippet({ 87 | requiredDependencies: snip[0], 88 | snippet: snip[1] 89 | })); 90 | }); 91 | Promise.all(promises).then((all) => { 92 | // done 93 | }); 94 | } 95 | 96 | waitForInternalImplementation(): Thenable { 97 | if (this.served) 98 | return Promise.resolve(this.served); 99 | else 100 | return new Promise((resolve) => { 101 | if (this.served) 102 | resolve(this.served); 103 | else 104 | this.onInternalImplementationReady(resolve); 105 | }); 106 | } 107 | 108 | // singleton 109 | static instance?: CodedAPIServedImpl; 110 | static getInstance(): CodedAPIServedImpl { 111 | if (this.instance) 112 | return this.instance; 113 | else 114 | return this.instance = new CodedAPIServedImpl(); 115 | } 116 | } -------------------------------------------------------------------------------- /src/builtin_plugins.ts: -------------------------------------------------------------------------------- 1 | import { CodedAPI } from "code-d-api"; 2 | 3 | export function builtinPlugins(instance: CodedAPI) { 4 | // built-in extensions can be put here if they are supposed to come with 5 | // every code-d install. 6 | // Special plugins should be installed as separate vscode extensions! 7 | } 8 | -------------------------------------------------------------------------------- /src/dmode.ts: -------------------------------------------------------------------------------- 1 | import vscode = require("vscode"); 2 | 3 | export const D_MODE: vscode.DocumentFilter = { language: "d", scheme: "file" }; 4 | export const DML_MODE: vscode.DocumentFilter = { language: "dml", scheme: "file" }; 5 | export const DSCRIPT_MODE: vscode.DocumentFilter = { language: "dscript", scheme: "file" }; 6 | export const SDL_MODE: vscode.DocumentFilter = { language: "sdl", scheme: "file" }; 7 | export const DUB_MODE: vscode.DocumentFilter = { pattern: "**/dub.{sdl,json}", scheme: "file" }; 8 | export const DSCANNER_INI_MODE: vscode.DocumentFilter = { pattern: "**/dscanner.ini", scheme: "file" }; 9 | export const DIET_MODE: vscode.DocumentFilter = { language: "diet", scheme: "file" }; 10 | export const PROFILEGC_MODE: vscode.DocumentFilter = { pattern: "**/profilegc.log", scheme: "file" }; -------------------------------------------------------------------------------- /src/dub-view.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode" 2 | import * as path from "path" 3 | import { extensionContext } from "./extension"; 4 | 5 | export interface DubDependencyInfo { 6 | name: string; 7 | failed?: boolean; 8 | version: string; 9 | path: string; 10 | description: string; 11 | homepage: string; 12 | authors: string[]; 13 | copyright: string; 14 | license: string; 15 | subPackages: string[]; 16 | hasDependencies: boolean; 17 | root: boolean; 18 | } 19 | 20 | export class DubDependency extends vscode.TreeItem { 21 | constructor(info: DubDependencyInfo, command?: vscode.Command, icon?: string); 22 | constructor(info: string, command?: vscode.Command, icon?: string); 23 | constructor(info: DubDependencyInfo | string, command?: vscode.Command, icon?: string) { 24 | super(typeof info == "string" ? info : info.name + ": " + info.version + (info.failed ? " (failed loading)" : ""), 25 | typeof info == "string" ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed); 26 | if (typeof info == "object") { 27 | this.info = info; 28 | this.iconPath = { 29 | light: vscode.Uri.joinPath(extensionContext.extensionUri, "images", "dependency-light.svg"), 30 | dark: vscode.Uri.joinPath(extensionContext.extensionUri, "images", "dependency-dark.svg") 31 | }; 32 | this.command = { 33 | command: "code-d.viewDubPackage", 34 | title: "Open README", 35 | tooltip: "Open README", 36 | arguments: [info.path, info.name] 37 | }; 38 | this.contextValue = info.root ? "root" : "dependency"; 39 | } 40 | if (command) 41 | this.command = command; 42 | if (icon) 43 | this.iconPath = { 44 | light: vscode.Uri.joinPath(extensionContext.extensionUri, "images", icon + "-light.svg"), 45 | dark: vscode.Uri.joinPath(extensionContext.extensionUri, "images", icon + "-dark.svg") 46 | }; 47 | } 48 | 49 | info?: DubDependencyInfo; 50 | command?: vscode.Command; 51 | } 52 | -------------------------------------------------------------------------------- /src/gcprofiler.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from "vscode"; 2 | import { served } from "./extension"; 3 | import { openTextDocumentAtRange } from "./util"; 4 | 5 | interface ProfileQuickPick extends vscode.QuickPickItem { 6 | uri: string; 7 | line: number; 8 | } 9 | 10 | export class GCProfiler { 11 | static listProfileCache() { 12 | let entriesPromise = served.client.sendRequest("served/getProfileGCEntries"); 13 | 14 | let items: Thenable = entriesPromise.then(gcEntries => 15 | gcEntries.map(entry => { 16 | description: entry.type, 17 | detail: entry.bytesAllocated + " bytes allocated / " + entry.allocationCount + " allocations", 18 | label: entry.displayFile + ":" + entry.line, 19 | uri: entry.uri, 20 | line: entry.line 21 | })); 22 | 23 | vscode.window.showQuickPick(items).then(item => { 24 | if (item) 25 | openTextDocumentAtRange(vscode.Uri.parse(item.uri), item.line - 1); 26 | }); 27 | } 28 | 29 | profiles: any[] = []; 30 | } -------------------------------------------------------------------------------- /src/test/ci/.gitignore: -------------------------------------------------------------------------------- 1 | *.actual 2 | -------------------------------------------------------------------------------- /src/test/ci/syntax/d/array_comment.d: -------------------------------------------------------------------------------- 1 | auto a = ["a", // comment 2 | "b"]; -------------------------------------------------------------------------------- /src/test/ci/syntax/d/array_comment.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"keyword.operator.assign.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"string.double-quoted-string.d"},{"start":11,"end":12,"scope":"string.character.d"},{"start":12,"end":13,"scope":"string.double-quoted-string.d"},{"start":13,"end":14,"scope":"keyword.operator.comma.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":25,"scope":"comment.line.d"}] 2 | [{"start":0,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"string.double-quoted-string.d"},{"start":5,"end":6,"scope":"string.character.d"},{"start":6,"end":7,"scope":"string.double-quoted-string.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"meta.statement.end.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/calls.d: -------------------------------------------------------------------------------- 1 | void main() { 2 | auto headerBar = new HeaderBar(); 3 | headerBar.setTitle("Test"); 4 | headerBar.setShowCloseButton(true); 5 | setTitlebar(headerBar); 6 | } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/calls.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"}] 2 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":5,"scope":"storage.type.basic-type.d"},{"start":5,"end":6,"scope":"source.d"},{"start":6,"end":15,"scope":"variable.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"keyword.operator.assign.d"},{"start":17,"end":18,"scope":"source.d"},{"start":18,"end":22,"scope":"keyword.other.new.d"},{"start":22,"end":31,"scope":"entity.name.function.d"},{"start":31,"end":32,"scope":"source.d"},{"start":32,"end":33,"scope":"source.d"},{"start":33,"end":34,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":19,"scope":"entity.name.function.d"},{"start":19,"end":20,"scope":"source.d"},{"start":20,"end":21,"scope":"string.double-quoted-string.d"},{"start":21,"end":25,"scope":"string.character.d"},{"start":25,"end":26,"scope":"string.double-quoted-string.d"},{"start":26,"end":27,"scope":"source.d"},{"start":27,"end":28,"scope":"meta.statement.end.d"}] 4 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":29,"scope":"entity.name.function.d"},{"start":29,"end":30,"scope":"source.d"},{"start":30,"end":34,"scope":"constant.language.boolean.true.d"},{"start":34,"end":35,"scope":"source.d"},{"start":35,"end":36,"scope":"meta.statement.end.d"}] 5 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":12,"scope":"entity.name.function.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":22,"scope":"variable.d"},{"start":22,"end":23,"scope":"source.d"},{"start":23,"end":24,"scope":"meta.statement.end.d"}] 6 | [{"start":0,"end":2,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/comments.d: -------------------------------------------------------------------------------- 1 | // dfmt off 2 | alias baselineCases = AliasSeq!( 3 | Code!(ubyte, 16 / ubyte.sizeof)([ 4 | /* push rbp */ 0x55, 5 | /* mov rbp,rsp */ 0x48, 0x8b, 0xec, 6 | /* movd xmm0,edi */ 0x66, 0x0f, 0x6e, 0xc7, 7 | /* punpcklbw xmm0,xmm0 */ 0x66, 0x0f, 0x60, 0xc0, 8 | /* punpcklwd xmm0,xmm0 */ 0x66, 0x0f, 0x61, 0xc0, 9 | /* pshufd xmm0,xmm0,0x0 */ 0x66, 0x0f, 0x70, 0xc0, 0x00, 10 | /* pop rbp */ 0x5d, 11 | /* ret */ 0xc3, 12 | ]), 13 | Code!(ubyte*, 16 / ubyte.sizeof)([ 14 | /* push rbp */ 0x55, 15 | /* mov rbp,rsp */ 0x48, 0x8b, 0xec, 16 | /* movzx eax,BYTE PTR [rdi] */ 0x0f, 0xb6, 0x07, 17 | /* movd xmm0,eax */ 0x66, 0x0f, 0x6e, 0xc0, 18 | /* punpcklbw xmm0,xmm0 */ 0x66, 0x0f, 0x60, 0xc0, 19 | /* punpcklwd xmm0,xmm0 */ 0x66, 0x0f, 0x61, 0xc0, 20 | /* pshufd xmm0,xmm0,0x0 */ 0x66, 0x0f, 0x70, 0xc0, 0x00, 21 | /* pop rbp */ 0x5d, 22 | /* ret */ 0xc3, 23 | ]) 24 | ); -------------------------------------------------------------------------------- /src/test/ci/syntax/d/delegate.d: -------------------------------------------------------------------------------- 1 | void fn() { 2 | (() { fn(); }); 3 | ({ fn(); }); 4 | } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/delegate.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":7,"scope":"entity.name.function.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"}] 2 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":2,"scope":"source.d"},{"start":2,"end":3,"scope":"source.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"source.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"meta.statement.end.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":2,"scope":"source.d"},{"start":2,"end":3,"scope":"source.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":6,"scope":"entity.name.function.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"meta.statement.end.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"meta.statement.end.d"}] 4 | [{"start":0,"end":2,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/enum.d: -------------------------------------------------------------------------------- 1 | /** 2 | * Selector constants for ucurr_getName(). 3 | */ 4 | enum UCurrNameStyle { 5 | /** 6 | * Selector for ucurr_getName indicating a symbolic name for a 7 | * currency, such as "$" for USD. 8 | * @stable ICU 2.6 9 | */ 10 | UCURR_SYMBOL_NAME, 11 | 12 | /** 13 | * Selector for ucurr_getName indicating the long name for a 14 | * currency, such as "US Dollar" for USD. 15 | * @stable ICU 2.6 16 | */ 17 | UCURR_LONG_NAME, 18 | 19 | /** 20 | * Selector for getName() indicating the narrow currency symbol. 21 | * The narrow currency symbol is similar to the regular currency 22 | * symbol, but it always takes the shortest form: for example, 23 | * "$" instead of "US$" for USD in en-CA. 24 | * 25 | * @stable ICU 61 26 | */ 27 | UCURR_NARROW_SYMBOL_NAME, 28 | } 29 | -------------------------------------------------------------------------------- /src/test/ci/syntax/d/enum_type.d: -------------------------------------------------------------------------------- 1 | uint BIT = 1; 2 | enum uint BIT = 1; 3 | enum ABCD BIT = 1; -------------------------------------------------------------------------------- /src/test/ci/syntax/d/enum_type.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":8,"scope":"variable.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"keyword.operator.assign.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"constant.numeric.integer.decimal.d"},{"start":12,"end":13,"scope":"meta.statement.end.d"}] 2 | [{"start":0,"end":4,"scope":"storage.type.enum.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"storage.type.basic-type.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":13,"scope":"entity.name.type.enum.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"keyword.operator.assign.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"constant.numeric.integer.decimal.d"},{"start":17,"end":18,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":4,"scope":"storage.type.enum.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.type.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":13,"scope":"entity.name.type.enum.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"keyword.operator.assign.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"constant.numeric.integer.decimal.d"},{"start":17,"end":18,"scope":"meta.statement.end.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/ifs.d: -------------------------------------------------------------------------------- 1 | void main() { 2 | if (x) { 3 | } 4 | if (x) 5 | {} 6 | 7 | while (x) {} 8 | for (x; y; z) {} 9 | foreach (x, y; z) {} 10 | switch (x) {} 11 | final switch (x) {} 12 | } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/ifs.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"}] 2 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":3,"scope":"keyword.control.if.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"source.d"}] 3 | [{"start":0,"end":3,"scope":"source.d"}] 4 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":3,"scope":"keyword.control.if.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"source.d"}] 5 | [{"start":0,"end":4,"scope":"source.d"}] 6 | [{"start":0,"end":1,"scope":"source.d"}] 7 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":6,"scope":"keyword.control.while.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"variable.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"}] 8 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":4,"scope":"keyword.control.for.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"source.d"},{"start":6,"end":7,"scope":"variable.d"},{"start":7,"end":8,"scope":"meta.statement.end.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"variable.d"},{"start":10,"end":11,"scope":"meta.statement.end.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"variable.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"source.d"}] 9 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":8,"scope":"keyword.control.foreach.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"variable.d"},{"start":11,"end":12,"scope":"keyword.operator.comma.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":14,"scope":"variable.d"},{"start":14,"end":15,"scope":"keyword.operator.semi-colon.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"variable.d"},{"start":17,"end":18,"scope":"source.d"},{"start":18,"end":19,"scope":"source.d"},{"start":19,"end":20,"scope":"source.d"},{"start":20,"end":21,"scope":"source.d"}] 10 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":7,"scope":"keyword.control.switch.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"variable.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":14,"scope":"source.d"}] 11 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":13,"scope":"keyword.control.final.switch.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"variable.d"},{"start":16,"end":17,"scope":"source.d"},{"start":17,"end":18,"scope":"source.d"},{"start":18,"end":19,"scope":"source.d"},{"start":19,"end":20,"scope":"source.d"}] 12 | [{"start":0,"end":2,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/issue_288.d: -------------------------------------------------------------------------------- 1 | void main() { 2 | synchronized int x = 4; 3 | synchronized stateInfo.status = "can't connect (%s)".format(addr); 4 | return; 5 | synchronized (foo) {} 6 | int x; 7 | } 8 | 9 | synchronized class Foo { 10 | synchronized SomeFunction!(int) foo() {} 11 | synchronized int foo(); 12 | } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/issue_288.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"}] 2 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":13,"scope":"storage.class.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":17,"scope":"storage.type.basic-type.d"},{"start":17,"end":18,"scope":"source.d"},{"start":18,"end":19,"scope":"variable.d"},{"start":19,"end":20,"scope":"source.d"},{"start":20,"end":21,"scope":"keyword.operator.assign.d"},{"start":21,"end":22,"scope":"source.d"},{"start":22,"end":23,"scope":"constant.numeric.integer.decimal.d"},{"start":23,"end":24,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":13,"scope":"storage.class.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":30,"scope":"variable.d"},{"start":30,"end":31,"scope":"source.d"},{"start":31,"end":32,"scope":"keyword.operator.assign.d"},{"start":32,"end":33,"scope":"source.d"},{"start":33,"end":34,"scope":"string.double-quoted-string.d"},{"start":34,"end":37,"scope":"string.character.d"},{"start":37,"end":38,"scope":"string.double-quoted-string.d"},{"start":38,"end":48,"scope":"string.character.d"},{"start":48,"end":50,"scope":"string.double-quoted-string.d"},{"start":50,"end":51,"scope":"string.character.d"},{"start":51,"end":52,"scope":"string.double-quoted-string.d"},{"start":52,"end":53,"scope":"string.double-quoted-string.d"},{"start":53,"end":60,"scope":"entity.name.function.d"},{"start":60,"end":61,"scope":"source.d"},{"start":61,"end":65,"scope":"variable.d"},{"start":65,"end":66,"scope":"source.d"},{"start":66,"end":67,"scope":"meta.statement.end.d"}] 4 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":7,"scope":"keyword.control.return.d"},{"start":7,"end":8,"scope":"meta.statement.end.d"}] 5 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":13,"scope":"keyword.control.synchronized.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":18,"scope":"variable.d"},{"start":18,"end":19,"scope":"source.d"},{"start":19,"end":20,"scope":"source.d"},{"start":20,"end":21,"scope":"source.d"},{"start":21,"end":22,"scope":"source.d"}] 6 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"meta.statement.end.d"}] 7 | [{"start":0,"end":2,"scope":"source.d"}] 8 | [{"start":0,"end":1,"scope":"source.d"}] 9 | [{"start":0,"end":12,"scope":"storage.class.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":18,"scope":"storage.type.class.d"},{"start":18,"end":19,"scope":"source.d"},{"start":19,"end":22,"scope":"entity.name.class.d"},{"start":22,"end":25,"scope":"source.d"}] 10 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":13,"scope":"storage.class.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":26,"scope":"variable.d"},{"start":26,"end":28,"scope":"source.d"},{"start":28,"end":31,"scope":"storage.type.basic-type.d"},{"start":31,"end":32,"scope":"source.d"},{"start":32,"end":33,"scope":"source.d"},{"start":33,"end":36,"scope":"entity.name.function.d"},{"start":36,"end":37,"scope":"source.d"},{"start":37,"end":38,"scope":"source.d"},{"start":38,"end":39,"scope":"source.d"},{"start":39,"end":40,"scope":"source.d"},{"start":40,"end":41,"scope":"source.d"}] 11 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":13,"scope":"storage.class.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":17,"scope":"storage.type.basic-type.d"},{"start":17,"end":18,"scope":"source.d"},{"start":18,"end":21,"scope":"entity.name.function.d"},{"start":21,"end":22,"scope":"source.d"},{"start":22,"end":23,"scope":"source.d"},{"start":23,"end":24,"scope":"meta.statement.end.d"}] 12 | [{"start":0,"end":2,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/keyword_types.d: -------------------------------------------------------------------------------- 1 | void main() { 2 | Joint j; 3 | cast(Joint)4; 4 | debugv = 5; 5 | } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/keyword_types.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"}] 2 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"variable.d"},{"start":8,"end":9,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":5,"scope":"keyword.operator.cast.d"},{"start":5,"end":6,"scope":"keyword.operator.cast.begin.d"},{"start":6,"end":11,"scope":"entity.name.type.d"},{"start":11,"end":12,"scope":"keyword.operator.cast.end.d"},{"start":12,"end":13,"scope":"constant.numeric.integer.decimal.d"},{"start":13,"end":14,"scope":"meta.statement.end.d"}] 4 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":7,"scope":"variable.d"},{"start":7,"end":8,"scope":"source.d"},{"start":8,"end":9,"scope":"keyword.operator.assign.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"constant.numeric.integer.decimal.d"},{"start":11,"end":12,"scope":"meta.statement.end.d"}] 5 | [{"start":0,"end":2,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/ligatures.d: -------------------------------------------------------------------------------- 1 | auto a = () => x; 2 | struct X(T...) {} -------------------------------------------------------------------------------- /src/test/ci/syntax/d/ligatures.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"keyword.operator.assign.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":14,"scope":"keyword.operator.lambda.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"variable.d"},{"start":16,"end":17,"scope":"meta.statement.end.d"}] 2 | [{"start":0,"end":6,"scope":"storage.type.struct.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"entity.name.type.struct.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"variable.d"},{"start":10,"end":13,"scope":"source.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/semicolons.d: -------------------------------------------------------------------------------- 1 | foo(); 2 | foo(); // comment 3 | foo(); /* comment */ 4 | foo();; 5 | foo(); bar(); -------------------------------------------------------------------------------- /src/test/ci/syntax/d/semicolons.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":3,"scope":"entity.name.function.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"meta.statement.end.d"}] 2 | [{"start":0,"end":3,"scope":"entity.name.function.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"meta.statement.end.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":17,"scope":"comment.line.d"}] 3 | [{"start":0,"end":3,"scope":"entity.name.function.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"meta.statement.end.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":9,"scope":"comment.block.begin.d"},{"start":9,"end":18,"scope":"comment.block.content.d"},{"start":18,"end":20,"scope":"comment.block.end.d"}] 4 | [{"start":0,"end":3,"scope":"entity.name.function.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"meta.statement.end.d"},{"start":6,"end":7,"scope":"meta.statement.end.d"}] 5 | [{"start":0,"end":3,"scope":"entity.name.function.d"},{"start":3,"end":4,"scope":"source.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"meta.statement.end.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":10,"scope":"entity.name.function.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"meta.statement.end.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/static_foreach.d: -------------------------------------------------------------------------------- 1 | static foreach (a; b) {} 2 | void main() { 3 | static foreach (a; b) {} 4 | foreach (a; b) {} 5 | } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/static_foreach.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":14,"scope":"keyword.control.static-foreach.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"variable.d"},{"start":17,"end":18,"scope":"keyword.operator.semi-colon.d"},{"start":18,"end":19,"scope":"source.d"},{"start":19,"end":20,"scope":"variable.d"},{"start":20,"end":21,"scope":"source.d"},{"start":21,"end":22,"scope":"source.d"},{"start":22,"end":23,"scope":"source.d"},{"start":23,"end":24,"scope":"source.d"}] 2 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"}] 3 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":15,"scope":"keyword.control.static-foreach.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"source.d"},{"start":17,"end":18,"scope":"variable.d"},{"start":18,"end":19,"scope":"keyword.operator.semi-colon.d"},{"start":19,"end":20,"scope":"source.d"},{"start":20,"end":21,"scope":"variable.d"},{"start":21,"end":22,"scope":"source.d"},{"start":22,"end":23,"scope":"source.d"},{"start":23,"end":24,"scope":"source.d"},{"start":24,"end":25,"scope":"source.d"}] 4 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":8,"scope":"keyword.control.foreach.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"variable.d"},{"start":11,"end":12,"scope":"keyword.operator.semi-colon.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":14,"scope":"variable.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":16,"scope":"source.d"},{"start":16,"end":17,"scope":"source.d"},{"start":17,"end":18,"scope":"source.d"}] 5 | [{"start":0,"end":2,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/static_if.d: -------------------------------------------------------------------------------- 1 | static if (/* hello world */ a is b && is(ushort32)) ushort32[] array; 2 | static assert (/**/ is(typeof(true))); 3 | void main() { if(is(typeof(x)) == 5) {} } -------------------------------------------------------------------------------- /src/test/ci/syntax/d/static_if.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":11,"scope":"keyword.control.static-if.begin.d"},{"start":11,"end":13,"scope":"comment.block.begin.d"},{"start":13,"end":26,"scope":"comment.block.content.d"},{"start":26,"end":28,"scope":"comment.block.end.d"},{"start":28,"end":29,"scope":"source.d"},{"start":29,"end":30,"scope":"variable.d"},{"start":30,"end":31,"scope":"source.d"},{"start":31,"end":33,"scope":"keyword.operator.identity.d"},{"start":33,"end":34,"scope":"source.d"},{"start":34,"end":35,"scope":"variable.d"},{"start":35,"end":36,"scope":"source.d"},{"start":36,"end":38,"scope":"keyword.operator.logical.d"},{"start":38,"end":39,"scope":"source.d"},{"start":39,"end":42,"scope":"keyword.token.is.begin.d"},{"start":42,"end":50,"scope":"variable.d"},{"start":50,"end":51,"scope":"keyword.token.is.end.d"},{"start":51,"end":52,"scope":"keyword.control.static-if.end.d"},{"start":52,"end":53,"scope":"source.d"},{"start":53,"end":61,"scope":"variable.d"},{"start":61,"end":62,"scope":"source.d"},{"start":62,"end":63,"scope":"source.d"},{"start":63,"end":64,"scope":"source.d"},{"start":64,"end":69,"scope":"variable.d"},{"start":69,"end":70,"scope":"meta.statement.end.d"}] 2 | [{"start":0,"end":15,"scope":"keyword.other.static-assert.begin.d"},{"start":15,"end":17,"scope":"comment.block.begin.d"},{"start":17,"end":19,"scope":"comment.block.end.d"},{"start":19,"end":20,"scope":"source.d"},{"start":20,"end":23,"scope":"keyword.token.is.begin.d"},{"start":23,"end":30,"scope":"keyword.token.typeof.d"},{"start":30,"end":34,"scope":"constant.language.boolean.true.d"},{"start":34,"end":35,"scope":"keyword.token.typeof.d"},{"start":35,"end":36,"scope":"keyword.token.is.end.d"},{"start":36,"end":37,"scope":"keyword.other.static-assert.end.d"},{"start":37,"end":38,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":9,"scope":"entity.name.function.d"},{"start":9,"end":10,"scope":"source.d"},{"start":10,"end":11,"scope":"source.d"},{"start":11,"end":12,"scope":"source.d"},{"start":12,"end":13,"scope":"source.d"},{"start":13,"end":14,"scope":"source.d"},{"start":14,"end":16,"scope":"keyword.control.if.d"},{"start":16,"end":17,"scope":"source.d"},{"start":17,"end":20,"scope":"keyword.token.is.begin.d"},{"start":20,"end":27,"scope":"keyword.token.typeof.d"},{"start":27,"end":28,"scope":"variable.d"},{"start":28,"end":29,"scope":"keyword.token.typeof.d"},{"start":29,"end":30,"scope":"keyword.token.is.end.d"},{"start":30,"end":31,"scope":"source.d"},{"start":31,"end":32,"scope":"keyword.operator.assign.d"},{"start":32,"end":33,"scope":"keyword.operator.assign.d"},{"start":33,"end":34,"scope":"source.d"},{"start":34,"end":35,"scope":"constant.numeric.integer.decimal.d"},{"start":35,"end":36,"scope":"source.d"},{"start":36,"end":37,"scope":"source.d"},{"start":37,"end":38,"scope":"source.d"},{"start":38,"end":39,"scope":"source.d"},{"start":39,"end":40,"scope":"source.d"},{"start":40,"end":41,"scope":"source.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/d/token_strings.d: -------------------------------------------------------------------------------- 1 | auto x = q{hello 2 | world { great! int x = 4; 3 | } 4 | }; -------------------------------------------------------------------------------- /src/test/ci/syntax/d/token_strings.d.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":4,"scope":"storage.type.basic-type.d"},{"start":4,"end":5,"scope":"source.d"},{"start":5,"end":6,"scope":"variable.d"},{"start":6,"end":7,"scope":"source.d"},{"start":7,"end":8,"scope":"keyword.operator.assign.d"},{"start":8,"end":9,"scope":"source.d"},{"start":9,"end":11,"scope":"string.quoted.token.d"},{"start":11,"end":16,"scope":"variable.d"}] 2 | [{"start":0,"end":5,"scope":"variable.d"},{"start":5,"end":8,"scope":"source.d"},{"start":8,"end":13,"scope":"variable.d"},{"start":13,"end":14,"scope":"keyword.operator.logical.d"},{"start":14,"end":15,"scope":"source.d"},{"start":15,"end":18,"scope":"storage.type.basic-type.d"},{"start":18,"end":19,"scope":"source.d"},{"start":19,"end":20,"scope":"variable.d"},{"start":20,"end":21,"scope":"source.d"},{"start":21,"end":22,"scope":"keyword.operator.assign.d"},{"start":22,"end":23,"scope":"source.d"},{"start":23,"end":24,"scope":"constant.numeric.integer.decimal.d"},{"start":24,"end":25,"scope":"meta.statement.end.d"}] 3 | [{"start":0,"end":2,"scope":"source.d"}] 4 | [{"start":0,"end":1,"scope":"source.d"},{"start":1,"end":2,"scope":"meta.statement.end.d"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/empty.dt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pure-D/code-d/71992a1a52a3025f3333e4025eee0f255a8cda03/src/test/ci/syntax/diet/empty.dt -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/empty.dt.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":1,"scope":"source.diet"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/extends.dt: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | p ok -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/extends.dt.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":7,"scope":"storage.type.import.include.diet"},{"start":7,"end":8,"scope":"meta.first-class.diet"},{"start":8,"end":14,"scope":"entity.name.type.include.diet"}] 2 | [{"start":0,"end":1,"scope":"source.diet"}] 3 | [{"start":0,"end":5,"scope":"storage.type.import.include.diet"},{"start":5,"end":6,"scope":"meta.first-class.diet"},{"start":6,"end":13,"scope":"entity.name.type.include.diet"}] 4 | [{"start":0,"end":1,"scope":"source.diet"},{"start":1,"end":2,"scope":"entity.name.tag.diet"},{"start":2,"end":5,"scope":"source.diet"}] -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/normal.dt: -------------------------------------------------------------------------------- 1 | doctype html 2 | 3 | html(lang="en") 4 | head 5 | meta(charset="UTF-8") 6 | meta(name="viewport", content="width=device-width, initial-scale=1.0") 7 | meta(http-equiv="X-UA-Compatible", content="ie=edge") 8 | title Document 9 | 10 | link(rel="stylesheet", href="style.css") 11 | body 12 | block content 13 | h1 hello world 14 | -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/one.dt: -------------------------------------------------------------------------------- 1 | tag.class#id(attr=code, attr=4, attr="value") hello world -------------------------------------------------------------------------------- /src/test/ci/syntax/diet/one.dt.expected: -------------------------------------------------------------------------------- 1 | [{"start":0,"end":3,"scope":"entity.name.tag.diet"},{"start":3,"end":9,"scope":"constant.other.class.diet"},{"start":9,"end":12,"scope":"constant.other.id.diet"},{"start":12,"end":13,"scope":"constant.name.attribute.tag.diet"},{"start":13,"end":17,"scope":"entity.other.attribute-name.tag.diet"},{"start":17,"end":18,"scope":"attribute_value"},{"start":18,"end":22,"scope":"variable.d"},{"start":22,"end":24,"scope":"meta.tag.other"},{"start":24,"end":28,"scope":"entity.other.attribute-name.tag.diet"},{"start":28,"end":29,"scope":"attribute_value"},{"start":29,"end":30,"scope":"constant.numeric.integer.decimal.d"},{"start":30,"end":32,"scope":"meta.tag.other"},{"start":32,"end":36,"scope":"entity.other.attribute-name.tag.diet"},{"start":36,"end":37,"scope":"attribute_value"},{"start":37,"end":38,"scope":"string.quoted.diet"},{"start":38,"end":43,"scope":"string.quoted.diet"},{"start":43,"end":44,"scope":"string.quoted.diet"},{"start":44,"end":45,"scope":"constant.name.attribute.tag.diet"},{"start":45,"end":57,"scope":"source.diet"}] -------------------------------------------------------------------------------- /src/test/runTest.ts: -------------------------------------------------------------------------------- 1 | import * as path from "path"; 2 | import * as fs from "fs"; 3 | import * as os from "os"; 4 | import * as cp from "child_process"; 5 | 6 | const packageJson = require("../../package.json"); 7 | 8 | import { 9 | downloadAndUnzipVSCode, 10 | resolveCliArgsFromVSCodeExecutablePath, 11 | runTests, 12 | } from "@vscode/test-electron"; 13 | import { rimraf } from "rimraf"; 14 | 15 | async function main() { 16 | try { 17 | // The folder containing the Extension Manifest package.json 18 | // Passed to `--extensionDevelopmentPath` 19 | const extensionDevelopmentPath = path.resolve(__dirname, "../../"); 20 | 21 | // The path to the extension test runner script 22 | // Passed to --extensionTestsPath 23 | const extensionTestsPath = path.resolve(__dirname, "./suite/index"); 24 | 25 | const vscodeExecutablePath = await downloadAndUnzipVSCode(); 26 | 27 | const [cliPath, ...args] = 28 | resolveCliArgsFromVSCodeExecutablePath(vscodeExecutablePath); 29 | 30 | // for (const extensionId of packageJson.extensionDependencies) { 31 | // cp.spawnSync(cliPath, [...args, "--install-extension", extensionId], { 32 | // encoding: "utf-8", 33 | // stdio: "inherit", 34 | // }); 35 | // } 36 | 37 | await rimraf(".vscode-test/user-data"); 38 | 39 | let cwd = fs.mkdtempSync(path.join(os.tmpdir(), "coded_project")); 40 | fs.writeFileSync(path.join(cwd, "dub.sdl"), 'name "codedproject"\n'); 41 | fs.mkdirSync(path.join(cwd, "source")); 42 | fs.writeFileSync( 43 | path.join(cwd, "source", "app.d"), 44 | 'import std.stdio;\n\nvoid main() {\n\twriteln("hello world");\n}\n' 45 | ); 46 | 47 | // Download VS Code, unzip it and run the integration test 48 | await runTests({ 49 | vscodeExecutablePath, 50 | extensionDevelopmentPath, 51 | launchArgs: [cwd], 52 | extensionTestsPath, 53 | extensionTestsEnv: { 54 | PROJECT_DIR: cwd, 55 | }, 56 | }); 57 | } catch (err) { 58 | console.error(err); 59 | console.error("Failed to run tests"); 60 | process.exit(1); 61 | } 62 | } 63 | 64 | main(); 65 | -------------------------------------------------------------------------------- /src/test/suite/index.ts: -------------------------------------------------------------------------------- 1 | import { glob } from "glob"; 2 | import * as Mocha from "mocha"; 3 | import * as path from "path"; 4 | 5 | export async function run(): Promise { 6 | // Create the mocha test 7 | const mocha = new Mocha({ 8 | ui: "tdd", 9 | timeout: 120000, 10 | }); 11 | 12 | const testsRoot = path.resolve(__dirname, ".."); 13 | 14 | let files = await glob("**/**.test.js", { cwd: testsRoot }); 15 | 16 | // Add files to the test suite 17 | files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f))); 18 | 19 | return new Promise((resolve, reject) => { 20 | // Run the mocha test 21 | try { 22 | mocha.run((failures) => { 23 | if (failures > 0) { 24 | reject(new Error(`${failures} tests failed.`)); 25 | } else { 26 | resolve(); 27 | } 28 | }); 29 | } catch (e) { 30 | reject(e); 31 | } 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /src/test/suite/it.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from "assert"; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from "vscode"; 6 | import { sleep, testCompletion } from "../utils"; 7 | // import * as myExtension from '../../extension'; 8 | 9 | suite("Integration Tests", () => { 10 | vscode.window.showInformationMessage("Start all tests."); 11 | 12 | // sanity test that we have the correct window open 13 | let workspaces = vscode.workspace.workspaceFolders; 14 | assert.strictEqual(workspaces?.length, 1); 15 | assert.strictEqual( 16 | workspaces[0].uri.fsPath.toLowerCase(), 17 | process.env["PROJECT_DIR"]!.toLowerCase() 18 | ); 19 | let workspace = workspaces[0]; 20 | 21 | test("check code-d installed", async () => { 22 | let coded = vscode.extensions.getExtension("webfreak.code-d")!; 23 | assert.notStrictEqual(coded, undefined, "code-d not installed?!"); 24 | }); 25 | 26 | function file(relative: string): vscode.Uri { 27 | return vscode.Uri.joinPath(workspace.uri, relative); 28 | } 29 | 30 | test("Wait for python and code-d extensions", async () => { 31 | let coded = vscode.extensions.getExtension("webfreak.code-d")!; 32 | await coded.activate(); 33 | await sleep(5000); // give sufficient startup time 34 | }); 35 | 36 | test("Recipe file", async () => { 37 | let recipe = await vscode.window.showTextDocument( 38 | await vscode.workspace.openTextDocument(file("dub.sdl")), 39 | vscode.ViewColumn.One 40 | ); 41 | 42 | await recipe.edit((edit) => { 43 | edit.insert(new vscode.Position(2, 0), "dep"); 44 | }); 45 | 46 | await testCompletion( 47 | recipe, 48 | new vscode.Position(2, 3), 49 | new vscode.CompletionList([ 50 | new vscode.CompletionItem( 51 | "dependency", 52 | vscode.CompletionItemKind.Field 53 | ), 54 | ]), 55 | "contains" 56 | ); 57 | }); 58 | 59 | // test('interactive', () => new Promise((resolve, reject) => {})); 60 | }); 61 | -------------------------------------------------------------------------------- /src/test/suite/semver.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | import { cmpSemver, parseSimpleSemver } from '../../installer'; 3 | 4 | // Defines a Mocha test suite to group tests of similar kind together 5 | suite("semver", () => { 6 | test("test parsing", () => { 7 | assert.deepStrictEqual(parseSimpleSemver("v1.0.0-beta.1.2"), 8 | [1, 0, 0, ["beta", 1, 2]]); 9 | }); 10 | test("test comparision", () => { 11 | assert.strictEqual(cmpSemver("v1.0.0", "v1.0.0"), 0); 12 | assert.strictEqual(cmpSemver("v1.0.0", "v1.0.1"), -1); 13 | assert.strictEqual(cmpSemver("v1.0.1", "v1.0.0"), 1); 14 | assert.strictEqual(cmpSemver("v1.0.0", "v1.1.0"), -1); 15 | assert.strictEqual(cmpSemver("v1.1.0", "v1.0.0"), 1); 16 | assert.strictEqual(cmpSemver("v1.0.0", "v2.0.0"), -1); 17 | assert.strictEqual(cmpSemver("v2.0.0", "v1.0.0"), 1); 18 | 19 | assert.strictEqual(cmpSemver("v1.0.0-beta", "v1.0.0-beta"), 0); 20 | assert.strictEqual(cmpSemver("v1.0.0-beta", "v1.0.0"), -1); 21 | assert.strictEqual(cmpSemver("v1.0.0", "v1.0.0-beta"), 1); 22 | assert.strictEqual(cmpSemver("v1.0.0-alpha", "v1.0.0-beta"), -1); 23 | assert.strictEqual(cmpSemver("v1.0.0-beta", "v1.0.0-alpha"), 1); 24 | 25 | assert.strictEqual(cmpSemver("v1.0.0-beta.1", "v1.0.0-beta.2"), -1); 26 | assert.strictEqual(cmpSemver("v1.0.0-beta.1.1", "v1.0.0-beta.2"), -1); 27 | assert.strictEqual(cmpSemver("v1.0.0-beta.2.1", "v1.0.0-beta.2"), 1); 28 | assert.strictEqual(cmpSemver("v1.0.0-beta.10", "v1.0.0-beta.1"), 1); 29 | }); 30 | }); -------------------------------------------------------------------------------- /src/test/suite/terminal_links.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | import { 3 | DTerminalLinkProvider, 4 | enableResolveAllFilePathsForTest, 5 | TerminalFileLink, 6 | dubPackagesHome 7 | } from '../../terminal-link-provider'; 8 | import * as osPath from 'path'; 9 | import * as vscode from 'vscode'; 10 | 11 | suite("terminal links", () => { 12 | enableResolveAllFilePathsForTest(); 13 | let provider = new DTerminalLinkProvider(); 14 | 15 | test("DUB path rewriting", async () => { 16 | assert.deepStrictEqual(await provider.provideTerminalLinks({ 17 | line: "../../elsewhere/.dub/packages/msgpack-d-1.0.1/msgpack-d/src/msgpack/common.d(532,9): Deprecation: usage of the `body` keyword is deprecated. Use `do` instead.", 18 | cwd: "/tmp/myproject" 19 | }), [ 20 | { 21 | startIndex: 0, 22 | length: 83, 23 | file: { 24 | path: vscode.Uri.file(osPath.join(dubPackagesHome, "msgpack-d-1.0.1/msgpack-d/src/msgpack/common.d")), 25 | line: 532, 26 | column: 9 27 | } 28 | } 29 | ]); 30 | }); 31 | 32 | test("DMD error reporting", async () => { 33 | assert.deepStrictEqual(await provider.provideTerminalLinks({ 34 | line: "source/app.d(5,15): Error: unable to read module `bm`", 35 | cwd: "/tmp/myproject" 36 | }), [ 37 | { 38 | startIndex: 0, 39 | length: 18, 40 | file: { 41 | path: vscode.Uri.file("/tmp/myproject/source/app.d"), 42 | line: 5, 43 | column: 15 44 | } 45 | } 46 | ]); 47 | }); 48 | 49 | test("D exceptions", async () => { 50 | assert.deepStrictEqual(await provider.provideTerminalLinks({ 51 | line: "core.exception.AssertError@source/app.d(6): Assertion failure", 52 | cwd: "/tmp/myproject" 53 | }), [ 54 | { 55 | startIndex: 27, 56 | length: 15, 57 | file: { 58 | path: vscode.Uri.file("/tmp/myproject/source/app.d"), 59 | line: 6, 60 | column: undefined 61 | } 62 | } 63 | ]); 64 | }); 65 | 66 | test("mixin errors", async () => { 67 | assert.deepStrictEqual(await provider.provideTerminalLinks({ 68 | line: "source/app.d-mixin-5(7,8): Error: unable to read module `foobar`", 69 | cwd: "/tmp/myproject" 70 | }), [ 71 | { 72 | startIndex: 0, 73 | length: 25, 74 | file: { 75 | path: vscode.Uri.file("/tmp/myproject/source/app.d"), 76 | line: 5, 77 | column: undefined 78 | } 79 | } 80 | ]); 81 | }); 82 | }); -------------------------------------------------------------------------------- /src/test/utils.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | import * as vscode from 'vscode'; 3 | 4 | export function sleep(ms: number): Promise { 5 | return new Promise((resolve) => setTimeout(resolve, ms)); 6 | } 7 | 8 | export async function testCompletion( 9 | editor: vscode.TextEditor, 10 | position: vscode.Position, 11 | expectedCompletionList: vscode.CompletionList, 12 | type: "exact" | "contains", 13 | testKeys: (keyof vscode.CompletionItem)[] = ["label", "kind"] 14 | ) { 15 | editor = await vscode.window.showTextDocument(editor.document, editor.viewColumn); 16 | await sleep(500); 17 | editor.selection = new vscode.Selection(position, position); 18 | await sleep(500); 19 | 20 | // Executing the command `vscode.executeCompletionItemProvider` to simulate triggering completion 21 | const actualCompletionList = (await vscode.commands.executeCommand( 22 | 'vscode.executeCompletionItemProvider', 23 | editor.document.uri, 24 | position 25 | )) as vscode.CompletionList; 26 | 27 | if (type === "exact") { 28 | assert.strictEqual(actualCompletionList.items.length, expectedCompletionList.items.length); 29 | expectedCompletionList.items.forEach((expectedItem, i) => { 30 | const actualItem = actualCompletionList.items[i]; 31 | testKeys.forEach(key => { 32 | assert.strictEqual(actualItem[key], expectedItem[key], 33 | "completion " 34 | + JSON.stringify(expectedItem.label) 35 | + " mismatch on key " + JSON.stringify(key) + ":\n" 36 | + "expected = " + JSON.stringify(expectedItem[key]) + "\n" 37 | + " actual = " + JSON.stringify(actualItem[key])); 38 | }); 39 | }); 40 | } else if (type === "contains") { 41 | assert.ok(actualCompletionList.items.length >= expectedCompletionList.items.length, 42 | "Expected at least " + expectedCompletionList.items.length 43 | + " completions, but only got " + actualCompletionList.items.length); 44 | expectedCompletionList.items.forEach((expectedItem, i) => { 45 | const actualItem = actualCompletionList.items.find(i => i.label == expectedItem.label); 46 | if (!actualItem) 47 | assert.fail("can't find completion item " 48 | + JSON.stringify(expectedItem.label) 49 | + " in " 50 | + JSON.stringify(actualCompletionList.items.map(c => c.label))); 51 | 52 | testKeys.forEach(key => { 53 | assert.strictEqual(actualItem[key], expectedItem[key], 54 | "completion " 55 | + JSON.stringify(expectedItem.label) 56 | + " mismatch on key " + JSON.stringify(key) + ":\n" 57 | + "expected = " + JSON.stringify(expectedItem[key]) + "\n" 58 | + " actual = " + JSON.stringify(actualItem[key])); 59 | }); 60 | }); 61 | } else { 62 | throw new Error("invalid type"); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/uninstall.ts: -------------------------------------------------------------------------------- 1 | import * as path from "path" 2 | import * as fs from "fs" 3 | var rimraf = require("rimraf"); 4 | 5 | function determineOutputFolder(): string | undefined { 6 | if (process.platform == "linux") { 7 | if (!(process.env).HOME) 8 | return undefined; 9 | 10 | if (fs.existsSync(path.join((process.env).HOME, ".local", "share"))) 11 | return path.join((process.env).HOME, ".local", "share", "code-d"); 12 | else 13 | return path.join((process.env).HOME, ".code-d"); 14 | } 15 | else if (process.platform == "win32") { 16 | if (!(process.env).APPDATA) 17 | return undefined; 18 | 19 | return path.join((process.env).APPDATA, "code-d"); 20 | } 21 | else { 22 | return undefined; 23 | } 24 | } 25 | 26 | var codedFolder = determineOutputFolder(); 27 | if (codedFolder) { 28 | console.log("Deleting code-d binaries folder:", codedFolder); 29 | rimraf.sync(codedFolder); 30 | } 31 | -------------------------------------------------------------------------------- /syntaxes/codeblock.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileTypes": [], 3 | "injectionSelector": "L:text.html.markdown", 4 | "patterns": [ 5 | { 6 | "include": "#d-code-block" 7 | } 8 | ], 9 | "repository": { 10 | "d-code-block": { 11 | "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(d)(\\s+[^`~]*)?$)", 12 | "name": "markup.fenced_code.block.markdown", 13 | "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$", 14 | "beginCaptures": { 15 | "3": { 16 | "name": "punctuation.definition.markdown" 17 | }, 18 | "4": { 19 | "name": "fenced_code.block.language.markdown" 20 | }, 21 | "5": { 22 | "name": "fenced_code.block.language.attributes.markdown" 23 | } 24 | }, 25 | "endCaptures": { 26 | "3": { 27 | "name": "punctuation.definition.markdown" 28 | } 29 | }, 30 | "patterns": [ 31 | { 32 | "begin": "(^|\\G)(\\s*)(.*)", 33 | "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)", 34 | "contentName": "meta.embedded.block.d", 35 | "patterns": [ 36 | { 37 | "include": "source.d" 38 | } 39 | ] 40 | } 41 | ] 42 | } 43 | }, 44 | "scopeName": "markdown.d.codeblock" 45 | } -------------------------------------------------------------------------------- /syntaxes/d.yml-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Jan Van Uytven 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | --- 10 | 11 | Taken from https://github.com/ysgard/d-struct 12 | converted using cson2json 13 | then converted using github.com/sjmulder/json-yaml (gave optimal output with no unneccesary quotes) 14 | -------------------------------------------------------------------------------- /syntaxes/dml.yml: -------------------------------------------------------------------------------- 1 | fileTypes: 2 | - dml 3 | name: DlangUI Markup Language 4 | scopeName: source.dml 5 | patterns: 6 | - match: \b(true|false|null)\b 7 | name: constant.language.dml 8 | - match: \b__(FILE|LINE|MODULE|(PRETTY_)?FUNCTION)__\b 9 | name: keyword.other.traits.dml 10 | - match: \b(this|super)\b 11 | name: variable.language.dml 12 | - match: \b(?=[^a-z]*[a-z])[A-Z]\w+\b 13 | name: storage.type.class.dml 14 | - comment: decimal integers 15 | match: \b(?Hello Diamond!

18 | -------------------------------------------------------------------------------- /templates/EmptyDiamondWebsite/views/layout.dd: -------------------------------------------------------------------------------- 1 | @ 2 | 3 | 4 | @<title> 5 | 6 | 7 | @ 8 | 9 | 10 | -------------------------------------------------------------------------------- /templates/EmptyDlangUI/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyDlangUI/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyDlangUI/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyDlangUI/source/app.d: -------------------------------------------------------------------------------- 1 | import dlangui; 2 | 3 | mixin APP_ENTRY_POINT; 4 | 5 | /// Entry point for dlangui based application 6 | extern (C) int UIAppMain(string[] args) 7 | { 8 | // Create window 9 | // arguments: title, parent, flags = WindowFlag.Resizable, width = 0, height = 0 10 | Window window = Platform.instance.createWindow("My App", null); 11 | 12 | // Load layout from views/MainWindow.dml and show it 13 | // Use readText("views/MainWindow.dml") from std.file to allow dynamic layout editting without recompilation 14 | auto layout = parseML(import("MainWindow.dml")); 15 | window.mainWidget = layout; 16 | 17 | // Show window 18 | window.show(); 19 | 20 | // Run message loop 21 | return Platform.instance.enterMessageLoop(); 22 | } 23 | -------------------------------------------------------------------------------- /templates/EmptyDlangUI/views/MainWindow.dml: -------------------------------------------------------------------------------- 1 | VerticalLayout { 2 | TextWidget { 3 | text: "Hello World" 4 | } 5 | } -------------------------------------------------------------------------------- /templates/EmptyGTKD/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyGTKD/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyGTKD/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyGTKD/source/app.d: -------------------------------------------------------------------------------- 1 | import gtk.MainWindow; 2 | import gtk.Label; 3 | import gtk.Main; 4 | 5 | void main(string[] args) 6 | { 7 | // Initializes gtk runtime 8 | Main.init(args); 9 | 10 | // Creates a MainWindow 11 | MainWindow window = new MainWindow("My App"); 12 | window.setDefaultSize(400, 300); 13 | // Adds a new label to the layout 14 | window.add(new Label("Hello World")); 15 | // Shows all widgets added to the layout 16 | window.showAll(); 17 | 18 | // Starts message loop and displays MainWindow 19 | Main.run(); 20 | } 21 | -------------------------------------------------------------------------------- /templates/EmptyLegacyOpenGL_SDL/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyLegacyOpenGL_SDL/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyLegacyOpenGL_SDL/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyLegacyOpenGL_SDL/source/app.d: -------------------------------------------------------------------------------- 1 | import bindbc.sdl; 2 | import bindbc.opengl; 3 | 4 | import std.stdio; 5 | import std.string; 6 | 7 | int main() 8 | { 9 | SDLSupport sdlStatus = loadSDL(); 10 | if (sdlStatus != sdlSupport) 11 | { 12 | writeln("Failed loading SDL: ", sdlStatus); 13 | return 1; 14 | } 15 | 16 | if (SDL_Init(SDL_INIT_VIDEO) < 0) 17 | throw new SDLException(); 18 | 19 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); 20 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); 21 | 22 | auto window = SDL_CreateWindow("OpenGL 1.1 App", SDL_WINDOWPOS_UNDEFINED, 23 | SDL_WINDOWPOS_UNDEFINED, 400, 300, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); 24 | if (!window) 25 | throw new SDLException(); 26 | 27 | const context = SDL_GL_CreateContext(window); 28 | if (!context) 29 | throw new SDLException(); 30 | 31 | if (SDL_GL_SetSwapInterval(1) < 0) 32 | writeln("Failed to set VSync"); 33 | 34 | GLSupport glStatus = loadOpenGL(); 35 | if (glStatus < glSupport) 36 | { 37 | writeln("Failed loading OpenGL: ", glStatus); 38 | return 1; 39 | } 40 | 41 | glMatrixMode(GL_PROJECTION); 42 | glLoadIdentity(); 43 | 44 | glMatrixMode(GL_MODELVIEW); 45 | glLoadIdentity(); 46 | 47 | bool quit = false; 48 | SDL_Event event; 49 | while (!quit) 50 | { 51 | while (SDL_PollEvent(&event)) 52 | { 53 | switch (event.type) 54 | { 55 | case SDL_QUIT: 56 | quit = true; 57 | break; 58 | default: 59 | break; 60 | } 61 | } 62 | 63 | glClear(GL_COLOR_BUFFER_BIT); 64 | 65 | glBegin(GL_TRIANGLES); 66 | { 67 | glColor3f(1, 0, 0); 68 | glVertex2f(-0.5f, -0.5f); 69 | glColor3f(0, 1, 0); 70 | glVertex2f(0.5f, -0.5f); 71 | glColor3f(0, 0, 1); 72 | glVertex2f(0, 0.5f); 73 | } 74 | glEnd(); 75 | 76 | SDL_GL_SwapWindow(window); 77 | } 78 | 79 | return 0; 80 | } 81 | 82 | /// Exception for SDL related issues 83 | class SDLException : Exception 84 | { 85 | /// Creates an exception from SDL_GetError() 86 | this(string file = __FILE__, size_t line = __LINE__) nothrow @nogc 87 | { 88 | super(cast(string) SDL_GetError().fromStringz, file, line); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /templates/EmptyOpenGL_SDL/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyOpenGL_SDL/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyOpenGL_SDL/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyOpenGL_SDL/views/shader.frag: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | in vec3 color; 4 | out vec3 out_color; 5 | 6 | void main() { 7 | out_color = color; 8 | } -------------------------------------------------------------------------------- /templates/EmptyOpenGL_SDL/views/shader.vert: -------------------------------------------------------------------------------- 1 | #version 330 core 2 | 3 | layout(location = 0) in vec3 in_position; 4 | layout(location = 1) in vec3 in_color; 5 | 6 | out vec3 color; 7 | 8 | void main() { 9 | gl_Position = vec4(in_position, 1); 10 | color = in_color; 11 | } -------------------------------------------------------------------------------- /templates/EmptyVibeServer/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyVibeServer/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyVibeServer/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyVibeServer/source/app.d: -------------------------------------------------------------------------------- 1 | import vibe.vibe; 2 | 3 | void main() 4 | { 5 | auto settings = new HTTPServerSettings; 6 | settings.port = 3000; 7 | settings.bindAddresses = ["::1", "127.0.0.1"]; 8 | listenHTTP(settings, &hello); 9 | 10 | runApplication(); 11 | } 12 | 13 | void hello(HTTPServerRequest req, HTTPServerResponse res) 14 | { 15 | res.writeBody("Hello World"); 16 | } 17 | -------------------------------------------------------------------------------- /templates/EmptyWin32/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyWin32/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyWin32/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyWin32/source/app.d: -------------------------------------------------------------------------------- 1 | import core.runtime; 2 | import core.sys.windows.windows; 3 | import std.string; 4 | 5 | extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 6 | LPSTR lpCmdLine, int nCmdShow) 7 | { 8 | int result; 9 | 10 | try 11 | { 12 | Runtime.initialize(); 13 | result = myWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); 14 | Runtime.terminate(); 15 | } 16 | catch (Throwable e) 17 | { 18 | MessageBoxA(null, e.toString().toStringz(), null, MB_ICONEXCLAMATION); 19 | result = 0; 20 | } 21 | 22 | return result; 23 | } 24 | 25 | int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 26 | { 27 | MSG msg = MSG(null); 28 | WNDCLASS wc = WNDCLASS(0); 29 | wc.lpfnWndProc = &WndProc; 30 | wc.hInstance = hInstance; 31 | wc.hbrBackground = cast(HBRUSH)(COLOR_BACKGROUND); 32 | wc.lpszClassName = "myappclass"; 33 | if (!RegisterClass(&wc)) 34 | return 1; 35 | 36 | const(wchar)* windowTitle = "My App"; 37 | if (!CreateWindow(wc.lpszClassName, windowTitle, 38 | WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 400, 300, null, null, hInstance, null)) 39 | return 2; 40 | 41 | while (GetMessage(&msg, null, 0, 0) > 0) 42 | DispatchMessage(&msg); 43 | 44 | return 0; 45 | } 46 | 47 | extern (Windows) auto WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 48 | { 49 | switch (message) 50 | { 51 | case WM_CLOSE: 52 | PostQuitMessage(0); 53 | break; 54 | default: 55 | return DefWindowProc(hWnd, message, wParam, lParam); 56 | } 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /templates/EmptyX11/.gitignore: -------------------------------------------------------------------------------- 1 | .dub 2 | docs.json 3 | __dummy.html 4 | *.o 5 | *.obj 6 | -------------------------------------------------------------------------------- /templates/EmptyX11/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "code-d", 6 | "request": "launch", 7 | "dubBuild": true, 8 | "name": "Build & Debug DUB project", 9 | "cwd": "${command:dubWorkingDirectory}", 10 | "program": "${command:dubTarget}" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /templates/EmptyX11/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dub", 7 | "args": [ 8 | "build" 9 | ] 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /templates/EmptyX11/source/app.d: -------------------------------------------------------------------------------- 1 | import x11.X; 2 | import x11.Xlib; 3 | 4 | void main() 5 | { 6 | Display* display = XOpenDisplay(null); // Open default display (most of the time this is :0) 7 | if (!display) 8 | throw new Exception("Cannot open display"); 9 | scope (exit) 10 | XCloseDisplay(display); 11 | 12 | auto screen = DefaultScreen(display); 13 | // Create window 14 | auto window = XCreateSimpleWindow(display, RootWindow(display, screen), 10, 15 | 10, 100, 100, 1, BlackPixel(display, screen), WhitePixel(display, screen)); 16 | 17 | XSelectInput(display, window, ExposureMask | KeyPressMask); // Enable events 18 | XMapWindow(display, window); // Show window 19 | 20 | string message = "Hello World"; 21 | 22 | XEvent event; 23 | while (true) 24 | { 25 | XNextEvent(display, &event); 26 | if (event.type == Expose) 27 | { 28 | XDrawString(display, window, DefaultGC(display, screen), 10, 10, 29 | cast(char*) message.ptr, cast(int) message.length); 30 | } 31 | if (event.type == KeyPress) 32 | break; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /templates/info.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Empty Console Application", 4 | "detail": "An empty main function with some common includes", 5 | "path": "EmptyConsole", 6 | "dub": {} 7 | }, 8 | { 9 | "name": "Basic Console Application", 10 | "detail": "A console application with command line arguments and config loading", 11 | "path": "BasicConsole", 12 | "dub": {} 13 | }, 14 | { 15 | "name": "Empty DlangUI Application", 16 | "detail": "An empty cross-platform GUI application using DlangUI", 17 | "path": "EmptyDlangUI", 18 | "dub": { 19 | "dependencies": { 20 | "dlangui": "~>0.9.186" 21 | } 22 | } 23 | }, 24 | { 25 | "name": "Empty GtkD Application", 26 | "detail": "An empty GUI application using GtkD", 27 | "path": "EmptyGTKD", 28 | "dub": { 29 | "dependencies": { 30 | "gtk-d:gtkd": "~>3.10.0" 31 | } 32 | } 33 | }, 34 | { 35 | "name": "Empty Web Server", 36 | "detail": "An empty web server using vibe.d", 37 | "path": "EmptyVibeServer", 38 | "dub": { 39 | "dependencies": { 40 | "vibe-d": "~>0.9.4" 41 | } 42 | } 43 | }, 44 | { 45 | "name": "Basic Web Server", 46 | "detail": "A web server using vibe.d containing a placeholder index template and session support", 47 | "path": "BasicVibeServer", 48 | "dub": { 49 | "dependencies": { 50 | "vibe-d": "~>0.9.4" 51 | } 52 | } 53 | }, 54 | { 55 | "name": "Empty OpenGL Application using SDL", 56 | "detail": "A triangle in a SDL window using OpenGL 3.2", 57 | "path": "EmptyOpenGL_SDL", 58 | "dub": { 59 | "dependencies": { 60 | "bindbc-opengl": "~>1.0", 61 | "bindbc-sdl": "~>1.0" 62 | }, 63 | "versions": [ 64 | "SDL_204", 65 | "GL_32" 66 | ] 67 | } 68 | }, 69 | { 70 | "name": "Empty Legacy OpenGL Application using SDL", 71 | "detail": "A triangle in a SDL window using legacy OpenGL", 72 | "path": "EmptyLegacyOpenGL_SDL", 73 | "dub": { 74 | "dependencies": { 75 | "bindbc-opengl": "~>1.0", 76 | "bindbc-sdl": "~>1.0" 77 | }, 78 | "versions": [ 79 | "SDL_204", 80 | "GL_AllowDeprecated" 81 | ] 82 | } 83 | }, 84 | { 85 | "name": "Empty Win32 Application", 86 | "detail": "An empty window using the Win32 API", 87 | "path": "EmptyWin32", 88 | "dub": {} 89 | }, 90 | { 91 | "name": "Empty X11 Application", 92 | "detail": "An empty window using xlib", 93 | "path": "EmptyX11", 94 | "dub": { 95 | "dependencies": { 96 | "x11": "~>1.0.21" 97 | } 98 | } 99 | }, 100 | { 101 | "name": "Empty Diamond Website", 102 | "detail": "A basic website using Diamond MVC", 103 | "path": "EmptyDiamondWebsite", 104 | "dub": { 105 | "dependencies": { 106 | "vibe-d": "~>0.8.3", 107 | "diamond": "~>3.0.0", 108 | "mysql-native": "~>2.2.1" 109 | }, 110 | "versions": [ 111 | "VibeDefaultMain", 112 | "Diamond_Debug", 113 | "Diamond_WebServer" 114 | ], 115 | "sourcePaths": [ 116 | "core", 117 | "models", 118 | "controllers" 119 | ], 120 | "stringImportPaths": [ 121 | "config", 122 | "views" 123 | ] 124 | } 125 | }, 126 | { 127 | "name": "Empty Diamond Web-API", 128 | "detail": "A basic web-api using Diamond MVC", 129 | "path": "EmptyDiamondWebApi", 130 | "dub": { 131 | "dependencies": { 132 | "vibe-d": "~>0.8.3", 133 | "diamond": "~>3.0.0", 134 | "mysql-native": "~>2.2.1" 135 | }, 136 | "versions": [ 137 | "VibeDefaultMain", 138 | "Diamond_Debug", 139 | "Diamond_WebApi" 140 | ], 141 | "sourcePaths": [ 142 | "core", 143 | "models", 144 | "controllers" 145 | ], 146 | "stringImportPaths": [ 147 | "config" 148 | ] 149 | } 150 | } 151 | ] -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6", 8 | "dom" 9 | ], 10 | "sourceMap": true, 11 | "rootDir": "src", 12 | "strict": true 13 | }, 14 | "exclude": [ 15 | "node_modules", 16 | ".vscode-test" 17 | ] 18 | } -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "node": "registry:dt/node#6.0.0+20161019125345" 4 | }, 5 | "globalDependencies": { 6 | "node": "registry:env/node#6.0.0+20161019193037" 7 | } 8 | } 9 | --------------------------------------------------------------------------------