├── .gitignore ├── res └── icon.png ├── .vscodeignore ├── tslint.json ├── .vscode ├── settings.json ├── tasks.json └── launch.json ├── syntaxes ├── dpp.tmLanguage.json ├── diet.configuration.json ├── d.configuration.json ├── sdl.configuration.json ├── sdl.tmLanguage.json ├── diet.tmLanguage.json └── d.tmLanguage.json ├── src ├── util.ts ├── task-provider.ts └── extension.ts ├── tsconfig.json ├── webpack.config.ts ├── LICENSE.txt ├── README.md └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .vscode-test/ 4 | *.vsix 5 | -------------------------------------------------------------------------------- /res/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d-language-server/vscode-dlang/HEAD/res/icon.png -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | node_modules 4 | out/test/** 5 | out/**/*.map 6 | src/** 7 | .gitignore 8 | tsconfig.json 9 | tslint.json 10 | webpack.config.ts -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-string-throw": true, 4 | "no-unused-expression": true, 5 | "no-duplicate-variable": true, 6 | "curly": true, 7 | "class-name": true, 8 | "semicolon": [ 9 | true, 10 | "always" 11 | ], 12 | "triple-equals": true 13 | }, 14 | "defaultSeverity": "warning" 15 | } -------------------------------------------------------------------------------- /.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" 10 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "npm: watch", 8 | "type": "npm", 9 | "script": "watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /syntaxes/dpp.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.dpp", 3 | "name": "D++", 4 | "fileTypes": [ 5 | "dpp", 6 | "d++" 7 | ], 8 | "patterns": [ 9 | { 10 | "match": "(#include)\\s+([<\"][^\"]+[>\"])", 11 | "captures": { 12 | "1": { 13 | "name": "keyword.control.import.include.dpp" 14 | }, 15 | "2": { 16 | "name": "string.quoted.double.include.dpp" 17 | } 18 | } 19 | }, 20 | { 21 | "include": "source.d" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /src/util.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import * as fs from 'fs'; 4 | import * as path from 'path'; 5 | import * as vsc from 'vscode'; 6 | 7 | export const isWindows = process.platform === 'win32'; 8 | export const dub = vsc.workspace.getConfiguration('d').get('dubPath', 'dub') || findInPath(executableName('dub')); 9 | export const compiler = findInPath(executableName('dmd')) 10 | || findInPath(executableName('ldc2')) 11 | || findInPath(executableName('gdc')); 12 | 13 | export function findInPath(binary: string) { 14 | for (let p of process.env['PATH']!.split(isWindows ? ';' : ':')) { 15 | try { 16 | fs.statSync(path.join(p, binary)) 17 | return binary; 18 | } 19 | catch (err) { 20 | } 21 | } 22 | 23 | return null; 24 | } 25 | 26 | export function executableName(name: string) { 27 | return isWindows ? name + '.exe' : name; 28 | } 29 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | /* Strict Type-Checking Option */ 12 | "strict": true, /* enable all strict type-checking options */ 13 | /* Additional Checks */ 14 | "noUnusedLocals": true /* Report errors on unused locals. */ 15 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 16 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 17 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 18 | }, 19 | "exclude": [ 20 | "node_modules", 21 | ".vscode-test", 22 | "webpack.config.ts" 23 | ] 24 | } -------------------------------------------------------------------------------- /webpack.config.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | import * as webpack from 'webpack'; 3 | 4 | const config: webpack.Configuration = { 5 | target: 'node', 6 | entry: './src/extension.ts', 7 | output: { 8 | path: path.resolve(__dirname, 'out'), 9 | filename: 'extension.js', 10 | libraryTarget: 'commonjs2', 11 | devtoolModuleFilenameTemplate: '../[resource-path]' 12 | }, 13 | devtool: 'source-map', 14 | externals: { 15 | vscode: 'commonjs vscode' 16 | }, 17 | resolve: { 18 | extensions: ['.ts', '.js'] 19 | }, 20 | module: { 21 | rules: [ 22 | { 23 | test: /\.ts$/, 24 | exclude: /node_modules/, 25 | use: [ 26 | { 27 | loader: 'ts-loader' 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | }; 34 | 35 | export default config; 36 | -------------------------------------------------------------------------------- /syntaxes/diet.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//-", 4 | "blockComment": [ 5 | "" 7 | ] 8 | }, 9 | "autoClosingPairs": [ 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 | "surroundingPairs": [ 36 | [ 37 | "{", 38 | "}" 39 | ], 40 | [ 41 | "[", 42 | "]" 43 | ], 44 | [ 45 | "(", 46 | ")" 47 | ], 48 | [ 49 | "\"", 50 | "\"" 51 | ], 52 | [ 53 | "`", 54 | "`" 55 | ], 56 | [ 57 | "'", 58 | "'" 59 | ] 60 | ] 61 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Laurent Tréguier 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. 22 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "runtimeExecutable": "${execPath}", 13 | "args": [ 14 | "--extensionDevelopmentPath=${workspaceFolder}" 15 | ], 16 | "outFiles": [ 17 | "${workspaceFolder}/out/**/*.js" 18 | ], 19 | "preLaunchTask": "npm: watch" 20 | }, 21 | { 22 | "name": "Extension Tests", 23 | "type": "extensionHost", 24 | "request": "launch", 25 | "runtimeExecutable": "${execPath}", 26 | "args": [ 27 | "--extensionDevelopmentPath=${workspaceFolder}", 28 | "--extensionTestsPath=${workspaceFolder}/out/test" 29 | ], 30 | "outFiles": [ 31 | "${workspaceFolder}/out/test/**/*.js" 32 | ], 33 | "preLaunchTask": "npm: watch" 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # D support for Visual Studio Code 2 | 3 | ## This project is unmaintained, please use another one such as [serve-d](https://github.com/pure-d/code-d) 4 | 5 | [![Visual Studio Marketplace](https://img.shields.io/vscode-marketplace/v/LaurentTreguier.vscode-dls.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=LaurentTreguier.vscode-dls) 6 | 7 | A Visual Studio Code extension for [Dlang](https://dlang.org). 8 | Provides syntax highlighting, dub build integration with [VSCode tasks](https://code.visualstudio.com/Docs/editor/tasks) and editing features using the [Language Server protocol](https://microsoft.github.io/language-server-protocol). 9 | 10 | ## Features 11 | 12 | [DLS](https://github.com/d-language-server/dls) is used as a Language Server, which in turn uses libraries such as [DCD](http://dcd.dub.pm), [DFMT](http://dfmt.dub.pm), [D-Scanner](http://dscanner.dub.pm) as well as [other libraries](https://github.com/d-language-server/dls/blob/master/README.md) to provide language editing features. 13 | 14 | Look [here](https://github.com/d-language-server/dls) for an up-to-date list of features currently supported. 15 | Not every possible feature is implemented, but the server will update itself as new features come. 16 | 17 | ## Requirements 18 | 19 | Dub and a D compiler (DMD, LDC or GDC) should be installed for the extension to work properly. 20 | -------------------------------------------------------------------------------- /syntaxes/d.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ 5 | "/+", 6 | "+/" 7 | ] 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 | "\"", 38 | "\"" 39 | ], 40 | [ 41 | "`", 42 | "`" 43 | ], 44 | [ 45 | "'", 46 | "'" 47 | ] 48 | ], 49 | "surroundingPairs": [ 50 | [ 51 | "{", 52 | "}" 53 | ], 54 | [ 55 | "[", 56 | "]" 57 | ], 58 | [ 59 | "(", 60 | ")" 61 | ], 62 | [ 63 | "\"", 64 | "\"" 65 | ], 66 | [ 67 | "`", 68 | "`" 69 | ], 70 | [ 71 | "'", 72 | "'" 73 | ] 74 | ] 75 | } -------------------------------------------------------------------------------- /syntaxes/sdl.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ 5 | "/*", 6 | "*/" 7 | ] 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 | "\"", 38 | "\"" 39 | ], 40 | [ 41 | "`", 42 | "`" 43 | ], 44 | [ 45 | "'", 46 | "'" 47 | ] 48 | ], 49 | "surroundingPairs": [ 50 | [ 51 | "{", 52 | "}" 53 | ], 54 | [ 55 | "[", 56 | "]" 57 | ], 58 | [ 59 | "(", 60 | ")" 61 | ], 62 | [ 63 | "\"", 64 | "\"" 65 | ], 66 | [ 67 | "`", 68 | "`" 69 | ], 70 | [ 71 | "'", 72 | "'" 73 | ] 74 | ] 75 | } -------------------------------------------------------------------------------- /src/task-provider.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import * as vsc from 'vscode'; 4 | import * as util from './util'; 5 | 6 | export default class DubTaskProvider implements vsc.TaskProvider { 7 | provideTasks(token?: vsc.CancellationToken | undefined): vsc.ProviderResult { 8 | let defaultTaskDefinitions = [new DubTaskDefinition('build'), new DubTaskDefinition('test')]; 9 | let tasksConfig = vsc.workspace.getConfiguration('tasks'); 10 | 11 | return (tasksConfig.tasks || defaultTaskDefinitions) 12 | .filter((taskDef: DubTaskDefinition) => taskDef.type === 'dub') 13 | .map((taskDef: DubTaskDefinition) => { 14 | let args = [util.dub, taskDef.task]; 15 | 16 | for (let option of ['build', 'config', 'compiler', 'arch']) { 17 | if (option in taskDef) { 18 | if (taskDef[option]) { 19 | args.push(`--${option}=${taskDef[option]}`); 20 | } 21 | } 22 | } 23 | 24 | let execution = new vsc.ShellExecution(args.join(' ')); 25 | let task = new vsc.Task(taskDef, vsc.TaskScope.Workspace, taskDef.task, 'dub', execution, ['$dub-build', '$dub-test']); 26 | task.group = taskDef.task === 'build' ? vsc.TaskGroup.Build : vsc.TaskGroup.Test; 27 | return task; 28 | }); 29 | } 30 | 31 | resolveTask(task: vsc.Task, token?: vsc.CancellationToken | undefined): vsc.ProviderResult { 32 | return task; 33 | } 34 | } 35 | 36 | class DubTaskDefinition implements vsc.TaskDefinition { 37 | type = 'dub'; 38 | [name: string]: string | undefined; 39 | 40 | constructor(public task: DubTask, public build?: string, public config?: string, public compiler?: DubCompiler, public arch?: string) { 41 | } 42 | } 43 | 44 | type DubTask = 'build' | 'test'; 45 | type DubCompiler = 'dmd' | 'ldc2' | 'gdc'; 46 | -------------------------------------------------------------------------------- /syntaxes/sdl.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.sdl", 3 | "name": "SDL", 4 | "fileTypes": [ 5 | "sdl" 6 | ], 7 | "patterns": [ 8 | { 9 | "name": "comment.line.double-slash.sdl", 10 | "match": "//.*$" 11 | }, 12 | { 13 | "name": "comment.line.double-dash.sdl", 14 | "match": "--.*$" 15 | }, 16 | { 17 | "name": "comment.line.number-sign.sdl", 18 | "match": "#.*$" 19 | }, 20 | { 21 | "name": "comment.block.sdl", 22 | "begin": "/\\*", 23 | "end": "\\*/" 24 | }, 25 | { 26 | "name": "string.quoted.double.sdl", 27 | "begin": "\"", 28 | "end": "\"", 29 | "patterns": [ 30 | { 31 | "include": "#escaped-char" 32 | }, 33 | { 34 | "include": "#escaped-newline" 35 | } 36 | ] 37 | }, 38 | { 39 | "name": "string.quoted.other.backtick.sdl", 40 | "begin": "`", 41 | "end": "`" 42 | }, 43 | { 44 | "name": "string.quoted.single.sdl", 45 | "begin": "'", 46 | "end": "'", 47 | "patterns": [ 48 | { 49 | "include": "#escaped-char" 50 | }, 51 | { 52 | "include": "#oversized-char" 53 | } 54 | ] 55 | }, 56 | { 57 | "name": "string.unquoted.base64.sdl", 58 | "begin": "\\[", 59 | "end": "\\]", 60 | "patterns": [ 61 | { 62 | "include": "#unknown-base64-char" 63 | } 64 | ] 65 | }, 66 | { 67 | "name": "constant.language.boolean.sdl", 68 | "match": "\\b(?:true|false|on|off)\\b" 69 | }, 70 | { 71 | "name": "constant.language.null.sdl", 72 | "match": "\\bnull\\b" 73 | }, 74 | { 75 | "name": "constant.numeric.date.sdl", 76 | "match": "\\b\\d{4}/\\d{2}/\\d{2}(?:\\s+(?:\\d+d:)?\\d+:\\d+:\\d+\\.?\\d*(?:-[A-Z]{3})?)?\\b" 77 | }, 78 | { 79 | "name": "constant.numeric.duration.sdl", 80 | "match": "\\b(?:\\d+d:)?\\d+:\\d+:\\d+(?:\\.\\d+)?\\b" 81 | }, 82 | { 83 | "name": "constant.numeric.decimal.sdl", 84 | "match": "\\b\\d+(\\.\\d+)?(L|l|F|f|D|d|BD|bd)?\\b" 85 | }, 86 | { 87 | "match": "\\b([\\p{L}_][\\w\\-$.]*(:[\\p{L}_][\\w\\-$.]*)?)=", 88 | "captures": { 89 | "1": { 90 | "name": "entity.other.attribute-name.sdl" 91 | } 92 | } 93 | }, 94 | { 95 | "match": "(?:^|;|\\{)\\s*([\\p{L}_][\\w\\-$.]*(?::[\\p{L}_][\\w\\-$.]*)?)\\b", 96 | "captures": { 97 | "1": { 98 | "name": "entity.name.tag.sdl" 99 | } 100 | } 101 | } 102 | ], 103 | "repository": { 104 | "escaped-char": { 105 | "patterns": [ 106 | { 107 | "name": "constant.character.escape.sdl", 108 | "match": "\\\\." 109 | } 110 | ] 111 | }, 112 | "escaped-newline": { 113 | "patterns": [ 114 | { 115 | "name": "constant.character.escape.sdl", 116 | "match": "\\\\" 117 | } 118 | ] 119 | }, 120 | "oversized-char": { 121 | "patterns": [ 122 | { 123 | "name": "invalid.illegal.oversized-character.sdl", 124 | "match": "..." 125 | } 126 | ] 127 | }, 128 | "unknown-base64-char": { 129 | "patterns": [ 130 | { 131 | "name": "invalid.illegal.unknown-base64-character.sdl", 132 | "match": "[^0-9a-zA-Z+/=]" 133 | } 134 | ] 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import * as fs from 'fs'; 4 | import * as path from 'path'; 5 | import * as cp from 'child_process'; 6 | import * as rl from 'readline'; 7 | import * as net from 'net'; 8 | import * as vsc from 'vscode'; 9 | import * as lc from 'vscode-languageclient'; 10 | import * as util from './util'; 11 | import { promisify } from 'util'; 12 | import DubTaskProvider from './task-provider'; 13 | 14 | let socket: net.Socket; 15 | 16 | export async function activate(context: vsc.ExtensionContext) { 17 | vsc.workspace.registerTaskProvider('dub', new DubTaskProvider()); 18 | let dlsPath = vsc.workspace.getConfiguration('d').get('dlsPath') || await getDlsPath(); 19 | 20 | if (dlsPath.length) { 21 | try { 22 | await promisify(fs.stat)(dlsPath); 23 | return launchServer(context, dlsPath); 24 | } catch (err) { 25 | } 26 | } 27 | 28 | dlsPath = ''; 29 | let options: vsc.ProgressOptions = { location: vsc.ProgressLocation.Notification, title: 'Installing DLS' }; 30 | 31 | if (!util.dub) { 32 | return vsc.window.showErrorMessage('Dub not found in PATH'); 33 | } 34 | 35 | if (!util.compiler) { 36 | return vsc.window.showErrorMessage('No compiler found in PATH'); 37 | } 38 | 39 | return vsc.window.withProgress(options, async progress => { 40 | await new Promise(resolve => cp.spawn(util.dub!, ['remove', '--version=*', 'dls']).on('exit', resolve)); 41 | await new Promise(resolve => cp.spawn(util.dub!, ['fetch', 'dls']).on('exit', resolve)); 42 | 43 | let args = ['run', '--compiler=' + util.compiler, '--quiet', 'dls:bootstrap', '--', '--progress']; 44 | let bootstrap = cp.spawn(util.dub!, args); 45 | let totalSize = 0; 46 | let currentSize = 0; 47 | let promise = new Promise(resolve => bootstrap.stdout 48 | .on('data', data => dlsPath += data.toString()) 49 | .on('end', resolve)); 50 | 51 | rl.createInterface(bootstrap.stderr) 52 | .on('line', (line: string) => { 53 | const size = Number(line); 54 | 55 | if (line === 'extract') { 56 | progress.report({ message: 'Extracting' }); 57 | } else if (totalSize === 0) { 58 | totalSize = size; 59 | } else { 60 | currentSize = size; 61 | progress.report({ 62 | increment: 100 * (size - currentSize) / totalSize, 63 | message: 'Downloading' 64 | }); 65 | } 66 | }); 67 | 68 | await promise; 69 | return launchServer(context, dlsPath); 70 | }); 71 | } 72 | 73 | export function deactivate() { 74 | } 75 | 76 | async function getDlsPath() { 77 | let dlsExecutable = util.executableName('dls'); 78 | let dlsDir = path.join(process.env[util.isWindows ? 'LOCALAPPDATA' : 'HOME'], 79 | util.isWindows ? 'dub' : '.dub', 80 | 'packages', '.bin'); 81 | 82 | try { 83 | let dls = path.join(dlsDir, 'dls-latest', dlsExecutable); 84 | await promisify(fs.stat)(dls); 85 | return dls; 86 | } catch (err) { 87 | return path.join(dlsDir, dlsExecutable); 88 | } 89 | } 90 | 91 | function launchServer(context: vsc.ExtensionContext, dlsPath: string) { 92 | const serverOptions: lc.ServerOptions = vsc.workspace.getConfiguration('d').get('connectionType') === 'socket' 93 | ? () => createServerWithSocket(dlsPath).then(() => ({ reader: socket, writer: socket })) 94 | : () => createServerWithStdio(dlsPath); 95 | const clientOptions: lc.LanguageClientOptions = { 96 | documentSelector: [{ scheme: 'file', language: 'd' }], 97 | synchronize: { configurationSection: 'd.dls' }, 98 | initializationOptions: vsc.workspace.getConfiguration('d').get('init') 99 | }; 100 | const client = new lc.LanguageClient('d', 'DLS', serverOptions, clientOptions); 101 | client.onReady().then(() => { 102 | { 103 | let task: vsc.Progress<{ increment?: number, message?: string }>; 104 | let totalSize = 0; 105 | let currentSize = 0; 106 | let resolve: lc.GenericNotificationHandler; 107 | 108 | client.onNotification('$/dls/upgradeDls/didStart', 109 | (params: TranslationParams) => vsc.window.withProgress({ 110 | location: vsc.ProgressLocation.Notification, 111 | title: params.tr 112 | }, t => new Promise(r => { task = t; resolve = r; }))); 113 | client.onNotification('$/dls/upgradeDls/didStop', () => resolve()); 114 | client.onNotification('$/dls/upgradeDls/didChangeTotalSize', (params: DlsUpgradeSizeParams) => totalSize = params.size); 115 | client.onNotification('$/dls/upgradeDls/didChangeCurrentSize', (params: DlsUpgradeSizeParams) => { 116 | task.report({ 117 | increment: 100 * (params.size - currentSize) / totalSize, 118 | message: params.tr 119 | }); 120 | currentSize = params.size; 121 | }); 122 | client.onNotification('$/dls/upgradeDls/didExtract', 123 | (params: TranslationParams) => task.report({ message: params.tr })); 124 | } 125 | 126 | { 127 | let resolve: lc.GenericNotificationHandler; 128 | 129 | client.onNotification('$/dls/upgradeSelections/didStart', 130 | (params: TranslationParams) => vsc.window.withProgress({ 131 | location: vsc.ProgressLocation.Notification, 132 | title: params.tr 133 | }, () => new Promise(r => resolve = r))); 134 | client.onNotification('$/dls/upgradeSelections/didStop', () => resolve()); 135 | } 136 | }); 137 | 138 | let startingItem: vsc.StatusBarItem; 139 | client.onDidChangeState(e => { 140 | if (e.newState == lc.State.Starting) { 141 | startingItem = vsc.window.createStatusBarItem(vsc.StatusBarAlignment.Left); 142 | startingItem.text = 'Starting DLS...' 143 | startingItem.show(); 144 | } 145 | 146 | if (e.oldState == lc.State.Starting) { 147 | startingItem.dispose(); 148 | } 149 | }); 150 | 151 | context.subscriptions.push(client.start()); 152 | } 153 | 154 | function createServerWithStdio(dlsPath: string) { 155 | return Promise.resolve(cp.spawn(dlsPath.trim(), ['--stdio'])); 156 | } 157 | 158 | function createServerWithSocket(dlsPath: string) { 159 | let dls: cp.ChildProcess; 160 | return new Promise(resolve => { 161 | let server = net.createServer(s => { 162 | socket = s; 163 | socket.setNoDelay(true); 164 | server.close(); 165 | resolve(dls); 166 | }); 167 | 168 | server.listen(0, '127.0.0.1', () => { 169 | dls = cp.spawn(dlsPath.trim(), ['--socket=' + (server.address()).port]); 170 | }); 171 | }); 172 | } 173 | 174 | interface TranslationParams { 175 | tr: string; 176 | } 177 | 178 | interface DlsUpgradeSizeParams extends TranslationParams { 179 | size: number; 180 | } 181 | -------------------------------------------------------------------------------- /syntaxes/diet.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopeName": "source.diet", 3 | "name": "Diet", 4 | "fileTypes": [ 5 | "dt" 6 | ], 7 | "patterns": [ 8 | { 9 | "name": "comment.line.double-slash.diet", 10 | "match": "(//-?).*", 11 | "captures": { 12 | "1": { 13 | "name": "punctuation.definition.comment.d" 14 | } 15 | } 16 | }, 17 | { 18 | "match": "^\\s*(-)\\s*(.*)", 19 | "captures": { 20 | "1": { 21 | "name": "keyword.operator.diet" 22 | }, 23 | "2": { 24 | "patterns": [ 25 | { 26 | "include": "source.d" 27 | } 28 | ] 29 | } 30 | } 31 | }, 32 | { 33 | "match": "^\\s*(\\|)(.*)", 34 | "captures": { 35 | "1": { 36 | "name": "keyword.operator.diet" 37 | }, 38 | "2": { 39 | "patterns": [ 40 | { 41 | "include": "#tag-content" 42 | } 43 | ] 44 | } 45 | } 46 | }, 47 | { 48 | "match": "\\b(doctype)\\s+(.*)", 49 | "captures": { 50 | "1": { 51 | "name": "keyword.control.doctype.diet" 52 | }, 53 | "2": { 54 | "name": "entity.name.section.diet" 55 | } 56 | } 57 | }, 58 | { 59 | "match": "^\\s*(block|extends|include)\\s+(\\w+)", 60 | "captures": { 61 | "1": { 62 | "name": "storage.type.diet" 63 | }, 64 | "2": { 65 | "name": "variable.other.diet" 66 | } 67 | } 68 | }, 69 | { 70 | "begin": "(\\s*)(:)(css)\\b", 71 | "end": "^(?!\\1\\s)(?=\\s*\\S)", 72 | "beginCaptures": { 73 | "2": { 74 | "name": "storage.type.diet" 75 | }, 76 | "3": { 77 | "name": "entity.name.tag.filter.css.diet" 78 | } 79 | }, 80 | "patterns": [ 81 | { 82 | "include": "source.css" 83 | } 84 | ] 85 | }, 86 | { 87 | "begin": "(\\s*)(:)(htmlescape)\\b", 88 | "end": "^(?!\\1\\s)(?=\\s*\\S)", 89 | "beginCaptures": { 90 | "2": { 91 | "name": "storage.type.diet" 92 | }, 93 | "3": { 94 | "name": "entity.name.tag.filter.htmlescape.diet" 95 | } 96 | } 97 | }, 98 | { 99 | "begin": "(\\s*)(:)(javascript)\\b", 100 | "end": "^(?!\\1\\s)(?=\\s*\\S)", 101 | "beginCaptures": { 102 | "2": { 103 | "name": "storage.type.diet" 104 | }, 105 | "3": { 106 | "name": "entity.name.tag.filter.javascript.diet" 107 | } 108 | }, 109 | "patterns": [ 110 | { 111 | "include": "source.js" 112 | } 113 | ] 114 | }, 115 | { 116 | "begin": "(\\s*)(:)(markdown)\\b", 117 | "end": "^(?!\\1\\s)(?=\\s*\\S)", 118 | "beginCaptures": { 119 | "2": { 120 | "name": "storage.type.diet" 121 | }, 122 | "3": { 123 | "name": "entity.name.tag.filter.markdown.diet" 124 | } 125 | }, 126 | "patterns": [ 127 | { 128 | "include": "text.html.markdown" 129 | } 130 | ] 131 | }, 132 | { 133 | "name": "meta.tag.diet", 134 | "match": "^\\s*([-:\\w]+)?(?:(#)([-\\w]+))?((?:\\.[-\\w]+)*)(?<=\\S)(.*)", 135 | "captures": { 136 | "1": { 137 | "name": "entity.name.tag.diet" 138 | }, 139 | "2": { 140 | "name": "storage.type.id.diet" 141 | }, 142 | "3": { 143 | "name": "entity.other.attribute-name.id.diet" 144 | }, 145 | "4": { 146 | "patterns": [ 147 | { 148 | "name": "storage.type.class.diet", 149 | "match": "\\." 150 | }, 151 | { 152 | "name": "entity.name.class.diet", 153 | "match": "[^.]+" 154 | } 155 | ] 156 | }, 157 | "5": { 158 | "patterns": [ 159 | { 160 | "include": "#tag-content" 161 | }, 162 | { 163 | "include": "#tag-attributes" 164 | } 165 | ] 166 | } 167 | } 168 | } 169 | ], 170 | "repository": { 171 | "escaped-char": { 172 | "name": "constant.character.escape.diet", 173 | "match": "\\\\." 174 | }, 175 | "tag-attributes": { 176 | "begin": "\\(", 177 | "end": "\\)(.*)", 178 | "beginCaptures": { 179 | "0": { 180 | "name": "punctuation.section.parens.begin.diet" 181 | } 182 | }, 183 | "endCaptures": { 184 | "0": { 185 | "name": "punctuation.section.parens.end.diet" 186 | }, 187 | "1": { 188 | "patterns": [ 189 | { 190 | "include": "#tag-content" 191 | } 192 | ] 193 | } 194 | }, 195 | "patterns": [ 196 | { 197 | "match": "\\b(\\w+)\\b", 198 | "captures": { 199 | "1": { 200 | "name": "entity.other.attribute-name.diet" 201 | } 202 | } 203 | }, 204 | { 205 | "begin": "=", 206 | "end": "(?=,|\\))", 207 | "beginCaptures": { 208 | "0": { 209 | "name": "keyword.operator.assignment.diet" 210 | } 211 | }, 212 | "patterns": [ 213 | { 214 | "name": "constant.language.boolean.diet", 215 | "match": "\\b(false|true)\\b" 216 | }, 217 | { 218 | "name": "string.quoted.single.diet", 219 | "match": "(')[^']*(')", 220 | "captures": { 221 | "0": { 222 | "patterns": [ 223 | { 224 | "include": "#escaped-char" 225 | }, 226 | { 227 | "include": "#string-interpolation" 228 | } 229 | ] 230 | }, 231 | "1": { 232 | "name": "punctuation.definition.string.begin.diet" 233 | }, 234 | "2": { 235 | "name": "punctuation.definition.string.end.diet" 236 | } 237 | } 238 | }, 239 | { 240 | "name": "string.quoted.double.diet", 241 | "match": "(\")[^\"]+(\")", 242 | "captures": { 243 | "0": { 244 | "patterns": [ 245 | { 246 | "include": "#escaped-char" 247 | }, 248 | { 249 | "include": "#string-interpolation" 250 | } 251 | ] 252 | }, 253 | "1": { 254 | "name": "punctuation.definition.string.begin.diet" 255 | }, 256 | "2": { 257 | "name": "punctuation.definition.string.end.diet" 258 | } 259 | } 260 | }, 261 | { 262 | "include": "source.d" 263 | } 264 | ] 265 | } 266 | ] 267 | }, 268 | "tag-content": { 269 | "patterns": [ 270 | { 271 | "name": "keyword.operator.i18n.diet", 272 | "match": "&" 273 | }, 274 | { 275 | "name": "keyword.operator.whitespace-removal.diet", 276 | "match": "(<|>){1,2}" 277 | }, 278 | { 279 | "match": "(!?=)(.+)", 280 | "captures": { 281 | "1": { 282 | "name": "keyword.operator.diet" 283 | }, 284 | "2": { 285 | "patterns": [ 286 | { 287 | "include": "source.d" 288 | } 289 | ] 290 | } 291 | } 292 | }, 293 | { 294 | "patterns": [ 295 | { 296 | "include": "#string-interpolation" 297 | }, 298 | { 299 | "name": "constant.character.diet", 300 | "match": "&\\w+;" 301 | } 302 | ] 303 | } 304 | ] 305 | }, 306 | "string-interpolation": { 307 | "name": "meta.template.expression.diet", 308 | "begin": "(?" 426 | }, 427 | { 428 | "match": "^\\s*\\b(body|do|in|out)\\b(?=\\s*($|\\{|\\())", 429 | "captures": { 430 | "1": { 431 | "name": "keyword.control.d" 432 | } 433 | } 434 | }, 435 | { 436 | "name": "keyword.control.branch.d", 437 | "match": "\\b(break|case|continue|default|goto|(final\\s+)?switch|version)\\b" 438 | }, 439 | { 440 | "name": "keyword.control.conditional.d", 441 | "match": "\\b(else|(static\\s+)?if)\\b" 442 | }, 443 | { 444 | "name": "keyword.control.exception.d", 445 | "match": "\\b(catch|finally|throw|try)\\b" 446 | }, 447 | { 448 | "name": "keyword.control.import.d", 449 | "match": "\\bimport\\b" 450 | }, 451 | { 452 | "name": "keyword.control.loop.d", 453 | "match": "\\b(do|for|foreach(_reverse)?|while)\\b" 454 | }, 455 | { 456 | "name": "keyword.control.d", 457 | "match": "\\b(asm|debug|invariant|return|synchronized|unittest|with)\\b" 458 | }, 459 | { 460 | "name": "keyword.other.d", 461 | "match": "\\b((static\\s+)?assert|cast|in|is|macro|mixin|new|out|pragma|typeid|typeof|__traits)\\b" 462 | }, 463 | { 464 | "name": "keyword.other.special.d", 465 | "match": "\\b__(FILE|FILE_FULL_PATH|MODULE|LINE|FUNCTION|PRETTY_FUNCTION)__\\b" 466 | }, 467 | { 468 | "include": "#operator" 469 | }, 470 | { 471 | "name": "punctuation.accessor.d", 472 | "match": "\\." 473 | }, 474 | { 475 | "name": "storage.modifier.attribute.d", 476 | "contentName": "meta.parens.d", 477 | "begin": "(@)\\s*\\w*\\s*(\\()", 478 | "end": "\\)", 479 | "beginCaptures": { 480 | "1": { 481 | "name": "punctuation.definition.keyword.d" 482 | }, 483 | "2": { 484 | "name": "punctuation.section.parens.begin.d" 485 | } 486 | }, 487 | "endCaptures": { 488 | "0": { 489 | "name": "punctuation.section.parens.end.d" 490 | } 491 | }, 492 | "patterns": [ 493 | { 494 | "include": "$self" 495 | } 496 | ] 497 | }, 498 | { 499 | "name": "storage.modifier.attribute.d", 500 | "match": "(@)(?:(disable|nogc|property|safe|system|trusted)|\\w+)\\b", 501 | "captures": { 502 | "1": { 503 | "name": "punctuation.definition.keyword.d" 504 | }, 505 | "2": { 506 | "name": "support.constant.attribute.d" 507 | } 508 | } 509 | }, 510 | { 511 | "contentName": "meta.parens.d", 512 | "begin": "\\b(package)\\s*(\\()", 513 | "end": "\\)", 514 | "beginCaptures": { 515 | "1": { 516 | "name": "storage.modifier.visibility.d" 517 | }, 518 | "2": { 519 | "name": "punctuation.section.parens.begin.d" 520 | } 521 | }, 522 | "endCaptures": { 523 | "0": { 524 | "name": "punctuation.section.parens.end.d" 525 | } 526 | }, 527 | "patterns": [ 528 | { 529 | "name": "entity.name.namespace.d", 530 | "match": "[\\w.]+" 531 | } 532 | ] 533 | }, 534 | { 535 | "name": "storage.modifier.visibility.d", 536 | "match": "\\b(export|package|private|protected|public)\\b" 537 | }, 538 | { 539 | "name": "storage.modifier.d", 540 | "match": "\\b(abstract|alias|align|auto|const|deprecated|extern|final|immutable|inout|lazy|nothrow|override|pure|ref|scope|shared|static|volatile|__gshared)\\b" 541 | }, 542 | { 543 | "name": "storage.type.character.d", 544 | "match": "\\b(char|dchar|wchar)\\b" 545 | }, 546 | { 547 | "name": "storage.type.integer.d", 548 | "match": "\\b(byte|cent|int|long|short|size_t|ptrdiff_t|ubyte|ucent|uint|ulong|ushort)\\b" 549 | }, 550 | { 551 | "name": "storage.type.float.d", 552 | "match": "\\b(cdouble|cfloat|creal|double|float|idouble|ifloat|ireal|real)\\b" 553 | }, 554 | { 555 | "name": "storage.type.string.d", 556 | "match": "(?\"" 728 | }, 729 | { 730 | "name": "string.quoted.double.delimited.d", 731 | "begin": "q\"\\{", 732 | "end": "\\}\"" 733 | }, 734 | { 735 | "name": "string.quoted.double.delimited.d", 736 | "begin": "q\"(\\w+)$", 737 | "end": "^\\s*\\1\"" 738 | }, 739 | { 740 | "name": "string.quoted.double.hex.d", 741 | "contentName": "invalid.deprecated.hex.d", 742 | "begin": "x\"", 743 | "end": "\"(c|d|w)?", 744 | "patterns": [ 745 | { 746 | "name": "invalid.illegal.d", 747 | "match": "[^\\s\\da-fA-F]" 748 | } 749 | ] 750 | }, 751 | { 752 | "name": "string.quoted.double.raw.d", 753 | "begin": "r\"", 754 | "end": "\"(c|d|w)?" 755 | }, 756 | { 757 | "name": "string.quoted.double.d", 758 | "begin": "\"", 759 | "end": "\"(c|d|w)?", 760 | "patterns": [ 761 | { 762 | "include": "#string-escaped-char" 763 | } 764 | ] 765 | }, 766 | { 767 | "name": "string.quoted.other.backtick.raw.d", 768 | "begin": "`", 769 | "end": "`(c|d|w)?" 770 | }, 771 | { 772 | "name": "string.unquoted.token.d", 773 | "begin": "q{", 774 | "end": "}", 775 | "patterns": [ 776 | { 777 | "include": "$self" 778 | } 779 | ] 780 | } 781 | ] 782 | }, 783 | "string-escaped-char": { 784 | "name": "constant.character.escape.d", 785 | "match": "\\\\(['\"?\\\\0abnfrtv]|x[\\da-fA-F]{2}|[0-3]?[0-7]{1,2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8}|&[\\p{L}]{1,8};)" 786 | }, 787 | "integer-literal": { 788 | "patterns": [ 789 | { 790 | "name": "constant.numeric.binary.integer.d", 791 | "match": "\\b0[bB][01_]+(L?[uU]?|[uU]L)?\\b" 792 | }, 793 | { 794 | "name": "constant.numeric.hex.integer.d", 795 | "match": "\\b0[xX][\\da-fA-F_]+(L?[uU]?|[uU]L)?(?!\\s*(\\.|[pPfF]))\\b" 796 | }, 797 | { 798 | "name": "constant.numeric.integer.d", 799 | "match": "\\b\\d[\\d_]*(L?[uU]?|[uU]L)?(?!\\s*(\\.|[eEfF]))\\b" 800 | } 801 | ] 802 | }, 803 | "operator": { 804 | "patterns": [ 805 | { 806 | "name": "keyword.operator.arithmetic.d", 807 | "match": "\\+|-|\\*|/|~|\\^|\\^\\^" 808 | }, 809 | { 810 | "name": "keyword.operator.assignment.d", 811 | "match": "(\\+|-|\\*|/|~|\\^|\\^\\^)?=" 812 | }, 813 | { 814 | "name": "keyword.operator.shift.d", 815 | "match": "<<|>>>?" 816 | }, 817 | { 818 | "name": "keyword.operator.comparison.d", 819 | "match": "==|!=|(<|>)=?|<>" 820 | }, 821 | { 822 | "name": "keyword.operator.logical.d", 823 | "match": "!|&&|\\|\\|" 824 | }, 825 | { 826 | "name": "keyword.operator.bitwise.d", 827 | "match": "&|\\|" 828 | }, 829 | { 830 | "name": "keyword.operator.ternary.d", 831 | "match": "\\?|:" 832 | }, 833 | { 834 | "name": "keyword.operator.variadic.d", 835 | "match": "\\.\\.\\." 836 | }, 837 | { 838 | "name": "keyword.operator.slice.d", 839 | "match": "\\.\\." 840 | } 841 | ] 842 | }, 843 | "function-support": { 844 | "name": "support.function.d", 845 | "match": "\\b(destroy|factory|opAssign|opBinary|opBinaryRight|opCall|opCmp|opDispatch|opDollar|opEquals|opIndex|opIndexAssign|opIndexOpAssign|opIndexUnary|opOpAssign|opSlice|opUnary|toHash|toString)\\b" 846 | }, 847 | "inline-assembly": { 848 | "patterns": [ 849 | { 850 | "name": "keyword.other.d.asm", 851 | "match": "\\b(align|even|naked|offsetof|seg)\\b" 852 | }, 853 | { 854 | "name": "storage.type.d.asm", 855 | "match": "\\b(near|far|byte|short|int|word|dword|qword|float|double|real)\\s+ptr\\b" 856 | }, 857 | { 858 | "name": "variable.language.register.d.asm", 859 | "match": "\\bST\\([0-7]\\)" 860 | }, 861 | { 862 | "name": "variable.language.register.d.asm", 863 | "match": "\\b(AL|AH|AX|EAX|BL|BH|BX|EBX|CL|CH|CX|ECX|DL|DH|DX|EDX|BP|EBP|SP|ESP|DI|EDI|SI|ESI|ES|CS|SS|DS|GS|FS|CR[02-4]|DR[0-367]|TR[3-7]|ST|MM[0-7]|(X|Y)MM([0-9]|1[0-5])|RAX|RBX|RCX|RDX|BPL|RBP|SPL|RSP|DIL|RDI|SIL|RSI|R([89]|1[0-5])(B|W|D)?)\\b" 864 | }, 865 | { 866 | "name": "variable.language.d.asm", 867 | "match": "\\b(this|__LOCAL_SIZE|\\$)\\b" 868 | }, 869 | { 870 | "name": "entity.name.function.d.asm", 871 | "match": "\\b(aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|and|andnpd|andnps|andpd|andps|arpl|bound|bsf|bsr|bswap|bt|btc|btr|bts|call|cbw|cdq|clc|cld|clflush|cli|clts|cmc|cmova|cmovae|cmovb|cmovbe|cmovc|cmove|cmovg|cmovge|cmovl|cmovle|cmovna|cmovnae|cmovnb|cmovnbe|cmovnc|cmovne|cmovng|cmovnge|cmovnl|cmovnle|cmovno|cmovnp|cmovns|cmovnz|cmovo|cmovp|cmovpe|cmovpo|cmovs|cmovz|cmp|cmppd|cmpps|cmps|cmpsb|cmpsd|cmpss|cmpsw|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvtsi2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvttpd2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cwde|da|daa|das|db|dd|de|dec|df|di|div|divpd|divps|divsd|divss|dl|dq|ds|dt|dw|emms|enter|f2xm1|fabs|fadd|faddp|fbld|fbstp|fchs|fclex|fcmovb|fcmovbe|fcmove|fcmovnb|fcmovnbe|fcmovne|fcmovnu|fcmovu|fcom|fcomi|fcomip|fcomp|fcompp|fcos|fdecstp|fdisi|fdiv|fdivp|fdivr|fdivrp|feni|ffree|fiadd|ficom|ficomp|fidiv|fidivr|fild|fimul|fincstp|finit|fist|fistp|fisub|fisubr|fld|fld1|fldcw|fldenv|fldl2e|fldl2t|fldlg2|fldln2|fldpi|fldz|fmul|fmulp|fnclex|fndisi|fneni|fninit|fnop|fnsave|fnstcw|fnstenv|fnstsw|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fscale|fsetpm|fsin|fsincos|fsqrt|fst|fstcw|fstenv|fstp|fstsw|fsub|fsubp|fsubr|fsubrp|ftst|fucom|fucomi|fucomip|fucomp|fucompp|fwait|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|hlt|idiv|imul|in|inc|ins|insb|insd|insw|int|into|invd|invlpg|iret|iretd|iretq|ja|jae|jb|jbe|jc|jcxz|je|jecxz|jg|jge|jl|jle|jmp|jna|jnae|jnb|jnbe|jnc|jne|jng|jnge|jnl|jnle|jno|jnp|jns|jnz|jo|jp|jpe|jpo|js|jz|lahf|lar|ldmxcsr|lds|lea|leave|les|lfence|lfs|lgdt|lgs|lidt|lldt|lmsw|lock|lods|lodsb|lodsd|lodsw|loop|loope|loopne|loopnz|loopz|lsl|lss|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|mov|movapd|movaps|movd|movdq2q|movdqa|movdqu|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsd|movss|movsw|movsx|movupd|movups|movzx|mul|mulpd|mulps|mulsd|mulss|neg|nop|not|or|orpd|orps|out|outs|outsb|outsd|outsw|packssdw|packsswb|packuswb|paddb|paddd|paddq|paddsb|paddsw|paddusb|paddusw|paddw|pand|pandn|pavgb|pavgw|pcmpeqb|pcmpeqd|pcmpeqw|pcmpgtb|pcmpgtd|pcmpgtw|pextrw|pinsrw|pmaddwd|pmaxsw|pmaxub|pminsw|pminub|pmovmskb|pmulhuw|pmulhw|pmullw|pmuludq|pop|popa|popad|popf|popfd|por|prefetchnta|prefetcht0|prefetcht1|prefetcht2|psadbw|pshufd|pshufhw|pshuflw|pshufw|pslld|pslldq|psllq|psllw|psrad|psraw|psrld|psrldq|psrlq|psrlw|psubb|psubd|psubq|psubsb|psubsw|psubusb|psubusw|psubw|punpckhbw|punpckhdq|punpckhqdq|punpckhwd|punpcklbw|punpckldq|punpcklqdq|punpcklwd|push|pusha|pushad|pushf|pushfd|pxor|rcl|rcpps|rcpss|rcr|rdmsr|rdpmc|rdtsc|rep|repe|repne|repnz|repz|ret|retf|rol|ror|rsm|rsqrtps|rsqrtss|sahf|sal|sar|sbb|scas|scasb|scasd|scasw|seta|setae|setb|setbe|setc|sete|setg|setge|setl|setle|setna|setnae|setnb|setnbe|setnc|setne|setng|setnge|setnl|setnle|setno|setnp|setns|setnz|seto|setp|setpe|setpo|sets|setz|sfence|sgdt|shl|shld|shr|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|sti|stmxcsr|stos|stosb|stosd|stosw|str|sub|subpd|subps|subsd|subss|syscall|sysenter|sysexit|sysret|test|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|verr|verw|wait|wbinvd|wrmsr|xadd|xchg|xlat|xlatb|xor|xorpd|xorps)\\b" 872 | }, 873 | { 874 | "name": "entity.name.function.d.asm", 875 | "match": "\\b(addsubpd|addsubps|fisttp|haddpd|haddps|hsubpd|hsubps|lddqu|monitor|movddup|movshdup|movsldup|mwait)\\b" 876 | }, 877 | { 878 | "name": "entity.name.function.d.asm", 879 | "match": "\\b(pavgusb|pf2id|pfacc|pfadd|pfcmpeq|pfcmpge|pfcmpgt|pfmax|pfmin|pfmul|pfnacc|pfpnacc|pfrcp|pfrcpit1|pfrcpit2|pfrsqit1|pfrsqrt|pfsub|pfsubr|pi2fd|pmulhrw|pswapd)\\b" 880 | }, 881 | { 882 | "include": "#string-literal" 883 | }, 884 | { 885 | "include": "#integer-literal" 886 | }, 887 | { 888 | "include": "#comment-line" 889 | }, 890 | { 891 | "include": "#comment-block" 892 | }, 893 | { 894 | "include": "#comment-block-nested" 895 | }, 896 | { 897 | "include": "#operator" 898 | }, 899 | { 900 | "name": "punctuation.terminator.d.asm", 901 | "match": ";" 902 | } 903 | ] 904 | }, 905 | ".util-count-braces": { 906 | "contentName": "meta.block.d", 907 | "begin": "\\{", 908 | "end": "\\}", 909 | "beginCaptures": { 910 | "0": { 911 | "name": "punctuation.section.block.begin.d" 912 | } 913 | }, 914 | "endCaptures": { 915 | "0": { 916 | "name": "punctuation.section.block.end.d" 917 | } 918 | }, 919 | "patterns": [ 920 | { 921 | "include": "$self" 922 | } 923 | ] 924 | }, 925 | ".util-count-brackets": { 926 | "contentName": "meta.brackets.d", 927 | "begin": "\\[", 928 | "end": "\\]", 929 | "beginCaptures": { 930 | "0": { 931 | "name": "punctuation.section.brackets.begin.d" 932 | } 933 | }, 934 | "endCaptures": { 935 | "0": { 936 | "name": "punctuation.section.brackets.end.d" 937 | } 938 | }, 939 | "patterns": [ 940 | { 941 | "name": "keyword.operator.length.d", 942 | "match": "\\$" 943 | }, 944 | { 945 | "name": "punctuation.separator.d", 946 | "match": ":" 947 | }, 948 | { 949 | "include": "$self" 950 | } 951 | ] 952 | }, 953 | ".util-count-parens": { 954 | "contentName": "meta.parens.d", 955 | "begin": "\\(", 956 | "end": "\\)", 957 | "beginCaptures": { 958 | "0": { 959 | "name": "punctuation.section.parens.begin.d" 960 | } 961 | }, 962 | "endCaptures": { 963 | "0": { 964 | "name": "punctuation.section.parens.end.d" 965 | } 966 | }, 967 | "patterns": [ 968 | { 969 | "name": "punctuation.separator.d", 970 | "match": ";" 971 | }, 972 | { 973 | "include": "$self" 974 | } 975 | ] 976 | } 977 | } 978 | } --------------------------------------------------------------------------------