├── .gitignore ├── icon.png ├── src ├── editor │ ├── commands │ │ ├── ICommand.ts │ │ ├── BlockCommentCommand.ts │ │ └── LineCommentCommand.ts │ └── providers │ │ └── CfmlSnippetsCompletionProvider.ts ├── test │ ├── index.ts │ └── ScriptContext.test.ts ├── cfmlMain.ts ├── parser │ └── ScriptContext.ts └── data │ └── CfmlSnippetsDataSource.ts ├── tslint.json ├── .vscodeignore ├── .vscode ├── settings.json ├── tasks.json └── launch.json ├── tsconfig.json ├── resources └── test │ └── ScriptContext │ ├── cfscript_test.cfc │ └── cfml_test.cfc ├── cfml.configuration.json ├── LICENSE ├── README.md ├── CHANGELOG.md ├── vsc-extension-quickstart.md ├── package.json ├── Gruntfile.js └── themes ├── cfml_dark.json └── cfml_light.json /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | node_modules 3 | .vscode-test/ 4 | *.vsix 5 | *.tmp 6 | .vs/ -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ilich/vscode-coldfusion/HEAD/icon.png -------------------------------------------------------------------------------- /src/editor/commands/ICommand.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | export interface ICommand { 3 | execute(): void; 4 | } 5 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended" 5 | ], 6 | "jsRules": {}, 7 | "rules": {}, 8 | "rulesDirectory": [] 9 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vs/** 2 | .vscode/** 3 | .vscode-test/** 4 | out/test/** 5 | out/**/*.map 6 | src/** 7 | .gitignore 8 | tsconfig.json 9 | tslint.json 10 | vsc-extension-quickstart.md 11 | Gruntfile.js 12 | package-lock.json 13 | resources/test/** 14 | *.tmp -------------------------------------------------------------------------------- /.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 | } -------------------------------------------------------------------------------- /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 | }, 12 | "exclude": [ 13 | "node_modules", 14 | ".vscode-test" 15 | ] 16 | } -------------------------------------------------------------------------------- /resources/test/ScriptContext/cfscript_test.cfc: -------------------------------------------------------------------------------- 1 | component { 2 | this.baseGreeting = "Hello, "; 3 | 4 | public string function getFullName (String firstName, String lastName) { 5 | var fullName = arguments.firstName & " " & arguments.lastName; 6 | return fullName; 7 | } 8 | 9 | public string function getGreeting (String firstName, String lastName) { 10 | var fullName = getFullName(argumentCollection=arguments); 11 | var greeting = this.baseGreeting & fullName; 12 | 13 | return greeting; 14 | } 15 | } -------------------------------------------------------------------------------- /.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 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /cfml.configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "//", 4 | "blockComment": [ "/*", "*/" ] 5 | }, 6 | "brackets": [ 7 | ["{", "}"], 8 | ["[", "]"], 9 | ["(", ")"] 10 | ], 11 | "autoClosingPairs": [ 12 | ["{", "}"], 13 | ["[", "]"], 14 | ["(", ")"], 15 | ["\"", "\""], 16 | ["'", "'"], 17 | ["#", "#"] 18 | ], 19 | "surroundingPairs": [ 20 | ["{", "}"], 21 | ["[", "]"], 22 | ["(", ")"], 23 | ["\"", "\""], 24 | ["'", "'"], 25 | ["#", "#"] 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /src/test/index.ts: -------------------------------------------------------------------------------- 1 | // 2 | // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING 3 | // 4 | // This file is providing the test runner to use when running extension tests. 5 | // By default the test runner in use is Mocha based. 6 | // 7 | // You can provide your own test runner if you want to override it by exporting 8 | // a function run(testRoot: string, clb: (error:Error) => void) that the extension 9 | // host can call to run the tests. The test runner is expected to use console.log 10 | // to report the results back to the caller. When the tests are finished, return 11 | // a possible error to the callback or null if none. 12 | 13 | import * as testRunner from "vscode/lib/testrunner"; 14 | 15 | // You can directly control Mocha options by uncommenting the following lines 16 | // See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info 17 | testRunner.configure({ 18 | ui: "tdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.) 19 | useColors: true, // colored output from test results 20 | }); 21 | 22 | module.exports = testRunner; 23 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.1.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: watch" 15 | }, 16 | { 17 | "name": "Launch Tests", 18 | "type": "extensionHost", 19 | "request": "launch", 20 | "runtimeExecutable": "${execPath}", 21 | "args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], 22 | "stopOnEntry": false, 23 | "sourceMaps": true, 24 | "outFiles": [ "${workspaceRoot}/out/test/**/*.js" ], 25 | "preLaunchTask": "npm: watch" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ilya Verbitskiy 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 | 23 | -------------------------------------------------------------------------------- /resources/test/ScriptContext/cfml_test.cfc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | SELECT FirstName, LastName 13 | FROM Customers 14 | WHERE ID > 1000 15 | 16 | 17 | 18 | x = 1; 19 | y = 20; 20 | result = x + y; 21 | writeDump(x); 22 | 23 | 24 | 25 | 26 | 27 | SELECT FirstName, LastName 28 | FROM Customers 29 | WHERE ID > 1000 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/editor/commands/BlockCommentCommand.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import * as vscode from "vscode"; 3 | import { LANGUAGE_ID } from "../../cfmlMain"; 4 | import { ScriptContext } from "../../parser/ScriptContext"; 5 | import { ICommand } from "./ICommand"; 6 | 7 | export class BlockCommentCommand implements ICommand { 8 | public execute() { 9 | const editor = vscode.window.activeTextEditor; 10 | const context = new ScriptContext(editor.document); 11 | 12 | let position = editor.selection.start; 13 | 14 | // first we should check if current selection starts with . 15 | // in this case we should start checking context after tag. 16 | // this is a workaround to support block comments. 17 | const selectedText = editor.document.getText(editor.selection); 18 | if (/[\s\t]*<\/[c]?[f]?script>/ig.test(selectedText)) { 19 | const line = editor.document.lineAt(position.line); 20 | position = line.range.end; 21 | } 22 | 23 | let config: vscode.LanguageConfiguration = { 24 | comments: { 25 | blockComment: [ "/*", "*/" ], 26 | }, 27 | }; 28 | 29 | if (!context.isScript(position) && !context.isCFQuery(position)) { 30 | config = { 31 | comments: { 32 | blockComment: [ "" ], 33 | }, 34 | }; 35 | } 36 | 37 | vscode.languages.setLanguageConfiguration(LANGUAGE_ID, config); 38 | vscode.commands.executeCommand("editor.action.blockComment"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/cfmlMain.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import * as vscode from "vscode"; 3 | import { BlockCommentCommand } from "./editor/commands/BlockCommentCommand"; 4 | import { LineCommentCommand } from "./editor/commands/LineCommentCommand"; 5 | import { CfmlSnippetsCompletionProvider } from "./editor/providers/CfmlSnippetsCompletionProvider"; 6 | 7 | export const LANGUAGE_ID = "cfml"; 8 | 9 | function isEnabled(paramName: string, defaultValue: boolean = true): boolean { 10 | let enabled: boolean; 11 | const config = vscode.workspace.getConfiguration("cfml"); 12 | if (config === null) { 13 | enabled = defaultValue; 14 | } else { 15 | enabled = config.get(paramName); 16 | } 17 | 18 | return enabled; 19 | } 20 | 21 | function activateCommentsSupport(context: vscode.ExtensionContext) { 22 | const lineComment = new LineCommentCommand(); 23 | const toggleLineCommentCommand = vscode.commands.registerCommand( 24 | "cfml.toggleLineComment", 25 | lineComment.execute); 26 | context.subscriptions.push(toggleLineCommentCommand); 27 | 28 | const blockComment = new BlockCommentCommand(); 29 | const toggleBlockCommentCommand = vscode.commands.registerCommand( 30 | "cfml.toggleBlockComment", 31 | blockComment.execute); 32 | context.subscriptions.push(toggleBlockCommentCommand); 33 | } 34 | 35 | function activateSnippets(context: vscode.ExtensionContext) { 36 | if (!isEnabled("snippets.enabled")) { 37 | return; 38 | } 39 | 40 | const snippetsProvider = new CfmlSnippetsCompletionProvider(); 41 | const provider = vscode.languages.registerCompletionItemProvider(LANGUAGE_ID, snippetsProvider); 42 | context.subscriptions.push(provider); 43 | } 44 | 45 | export function activate(context: vscode.ExtensionContext) { 46 | activateCommentsSupport(context); 47 | activateSnippets(context); 48 | } 49 | 50 | export function deactivate() { 51 | // TBD. It is not used at the moment. 52 | } 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Project discontinued 2 | 3 | Unfortunately, I won't be able to continue development on ColdFusion extension, due to lack of time. I suggest you give https://github.com/KamasamaK/vscode-cfml a try instead. 4 | 5 | ## Acknowledgements 6 | 7 | * [`coldfusion.tmbundle`](https://github.com/textmate/coldfusion.tmbundle) on which the syntax highlighting is based. 8 | * [`vscode-cfml`](https://github.com/KamasamaK/vscode-cfml), [`sublimetext-cfml`](https://github.com/jcberquist/sublimetext-cfml), [`sublimetext-coldfusion`](https://github.com/SublimeText/ColdFusion) and [Ortus Solutions](https://www.ortussolutions.com) as inspiration for some of the features and CFML parser regular expressions. 9 | * [`cfdocs`](https://github.com/foundeo/cfdocs) for documentation and the source for snippets. 10 | 11 | ## Contributors 12 | 13 | There were many contributors to the project. Thank you all for your help! You can find the list of contributors on https://github.com/ilich/vscode-coldfusion/pulls and https://github.com/ilich/vscode-coldfusion/issues pages. 14 | 15 | ## Features 16 | 17 | * **Syntax highlighting** 18 | 19 | * **`CFML Light` theme with CFML tags coloring support**. 20 | The theme is based on VS Code `Light+ (default light)` theme. The theme adds special color for standard CFML tags to improve code readability. 21 | 22 | * **`CFML Dark` theme with CFML tags coloring support**. 23 | The theme is based on VS Code `Dark+ (default dark)` theme. The theme adds special color for standard CFML tags to improve code readability. 24 | 25 | * **Build-in CFML tags and functions snippets**. 26 | 27 | ## Commands 28 | 29 | Used in Command Palette (Win/Linux: `CTRL+SHIFT+P`; Mac: `CMD+SHIFT+P`). Can also be bound to Keyboard Shortcuts (Win/Linux: `CTRL+K CTRL+S`; Mac: `CMD+K CMD+S`). 30 | 31 | - CFML: Toggle Line Comment (`CTRL+/`) 32 | - CFML: Toggle Block Comment (`SHIFT+ALT+A`) 33 | 34 | ## Settings 35 | 36 | The following are the configurable Settings (Win/Linux: `CTRL+,`; Mac: `CMD+,`) that this extension contributes to VS Code: 37 | 38 | - `cfml.snippets.enabled`: Enable built-in CFML tags and functions snippets. [*Default*: `true`] -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | ## v1.0.1 - 2018-01-01 8 | ### Added 9 | - CFML tags support to CFScript context. 10 | ### Changed 11 | - Fixed https://github.com/ilich/vscode-coldfusion/issues/36. 12 | 13 | ## v1.0.0 - 2017-12-29 14 | ### Added 15 | - `CFML Light` and `CFML Dark` themes with CFML tags support. 16 | - `cfml.snippets.enabled` setting. 17 | ### Changed 18 | - Changed language ID to be `cfml`. 19 | - Updated syntax highlighting based on the latest TextMate ColdFusion bundle. New syntax file understands built-in CFML tags. 20 | - Updated CFML snippets using https://cfdocs.org/ content. 21 | - Line comments (`CTRL+/`) and block comments (`SHIFT+ALT+A`) take current context into account. 22 | - Fixed https://github.com/ilich/vscode-coldfusion/issues/32. 23 | - Fixed https://github.com/ilich/vscode-coldfusion/issues/27. 24 | 25 | ## v0.0.11 - 2017-08-25 26 | ### Added 27 | - `WriteDump` snippet. 28 | ### Changed 29 | - Use CFML comments by default instead of CFScript comments. 30 | 31 | ## v0.0.10 - 2017-07-18 32 | ### Changed 33 | - Use `lang-cfml` as the language identifier for the extension due some other extension compatibility issues. 34 | 35 | ## v0.0.9 - 2017-07-17 36 | ### Changed 37 | - Use `cfml` instead of `lang-cfml` as the language identifier for the extension. 38 | 39 | ## v0.0.8 - 2017-07-16 40 | ### Added 41 | - Extension logo. 42 | 43 | ## v0.0.7 - 2017-07-16 44 | ### Changed 45 | - Updated syntax highlighting based on SublimeText bundle. 46 | 47 | ## v0.0.6 - skipped 48 | 49 | ## v0.0.5 - skipped 50 | 51 | ## v0.0.4 - 2016-11-23 52 | ### Added 53 | - Language configuration: comments support. 54 | 55 | ## v0.0.3 - 2016-02-16 56 | ### Changed 57 | - Updated syntax highlighting and added snippets TextMate ColdFusion bundle. 58 | 59 | ## v0.0.2 - 2016-02-14 60 | ### Changed 61 | - Syntax highlighting and refactoring. 62 | 63 | ## v0.0.1 - 2015-11-29 64 | ### Added 65 | - Initial Release. -------------------------------------------------------------------------------- /src/editor/commands/LineCommentCommand.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | import * as vscode from "vscode"; 3 | import { LANGUAGE_ID } from "../../cfmlMain"; 4 | import { ScriptContext } from "../../parser/ScriptContext"; 5 | import { ICommand } from "./ICommand"; 6 | 7 | export class LineCommentCommand implements ICommand { 8 | public execute() { 9 | const editor = vscode.window.activeTextEditor; 10 | const context = new ScriptContext(editor.document); 11 | const line = editor.document.lineAt(editor.selection.start.line); 12 | let position = line.range.end; 13 | 14 | // first we should check if current selection starts with or . 15 | // in this case we should start checking context after tag. 16 | // the same is applicable for and