diff --git a/.gitignore b/.gitignore index a2e04e20cbd45dce7b25f33dcdbb9d0b5a3f067a..d3969f24e88b55455d98d6e8cb76cabaffb2063d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ dist node_modules .vscode-test/ .vsix -*.vsix .DS_Store .rts2_cache_cjs diff --git a/.vscodeignore b/.vscodeignore index 38b8bcbb266ea1e759ae77b60b796ab86f7e9960..e2fe3adbec0b281ee973f6bcb79f1dd7269253bb 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,9 +1,17 @@ +.vscode/** +* * +* */** +* **/.DS_Store +* +* !package.json +* !README.md +* !dist/index.js +* !dist/server/index.js -!resources/**/* diff --git a/package-lock.json b/package-lock.json index 5248a8172b2401f7ea57269daae4976620b27038..b5aa6b87dd1afb681a05c3dd19a1959f7027a1bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,22 +1,16 @@ { "name": "vscode-tailwindcss", - "version": "0.2.0", + "version": "0.1.16", "lockfileVersion": 1, "requires": true, "dependencies": { - "@types/node": { - "version": "11.13.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.5.tgz", - "integrity": "sha512-/OMMBnjVtDuwX1tg2pkYVSqRIDSmNTnvVvmvP/2xiMAAWf4a5+JozrApCrO4WCAILmXVxfNoQ3E+0HJbNpFVGg==", - "dev": true - }, "@zeit/ncc": { { - "lockfileVersion": 1, + "version": "0.2.4", { - "requires": true, + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", { - "dependencies": { + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", "dev": true }, "ajv": { @@ -250,8 +244,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/color/-/color-3.1.0.tgz", "integrity": "sha512-CwyopLkuRYO5ei2EpzpIh6LqJMt6Mt+jZhO5VI5f/wJLZriXQE32/SSqzmrh+QB+AZT81Cj8yv+7zwToW8ahZg==", "name": "vscode-tailwindcss", -{ - "name": "vscode-tailwindcss", "name": "vscode-tailwindcss", "color-convert": "^1.9.1", "color-string": "^1.5.2" @@ -262,8 +254,6 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "name": "vscode-tailwindcss", -{ - "name": "vscode-tailwindcss", "name": "vscode-tailwindcss", "color-name": "1.1.3" } @@ -272,15 +262,12 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", { - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "dev": true + "safer-buffer": "~2.1.0" }, "color-string": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", "ajv": { -{ - "name": "vscode-tailwindcss", { "requires": { "color-name": "^1.0.0", @@ -374,9 +361,8 @@ }, "dlv": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.2.tgz", - "integrity": "sha512-xxD4VSH67GbRvSGUrckvha94RD7hjgOH7rqGxiytLpkaeMvixOHFZTGFK6EkIm3T761OVHT8ABHmGkq9gXgu6Q==", { -{ + "assert-plus": { }, "duplexer": { "version": "0.1.1", @@ -1216,9 +1202,8 @@ }, "os-tmpdir": { "version": "1.0.2", "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", { -{ + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", }, "path-dirname": { "version": "1.0.2", @@ -1441,17 +1426,14 @@ }, "semver": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", { -{ + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", "name": "vscode-tailwindcss", -{ - "name": "vscode-tailwindcss", "name": "vscode-tailwindcss", "is-arrayish": "^0.3.1" }, @@ -1459,10 +1441,9 @@ "dependencies": { "is-arrayish": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-/OMMBnjVtDuwX1tg2pkYVSqRIDSmNTnvVvmvP/2xiMAAWf4a5+JozrApCrO4WCAILmXVxfNoQ3E+0HJbNpFVGg==", "version": "11.13.5", - "version": "0.2.0", "dependencies": { - "dev": true } } }, @@ -1563,13 +1544,6 @@ "has-flag": "^2.0.0" } }, "version": "11.13.5", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tailwindcss-language-server/-/tailwindcss-language-server-0.0.1.tgz", - "integrity": "sha512-lMoncp8ICeUA1kLVaiKARRUKQxRndKtIelydoMgg3P2ZjAIfcptN8Nin848+VClr2wGoM3+9RZ71sDG1YrnX1g==", - "dev": true - }, - "version": "11.13.5", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", "version": "2.2.1", "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", @@ -1611,7 +1585,6 @@ "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "requires": { "os-tmpdir": "~1.0.2" } @@ -1874,14 +1847,12 @@ "vscode-jsonrpc": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz", "integrity": "sha512-/OMMBnjVtDuwX1tg2pkYVSqRIDSmNTnvVvmvP/2xiMAAWf4a5+JozrApCrO4WCAILmXVxfNoQ3E+0HJbNpFVGg==", - "append-buffer": { - "dev": true + "version": "0.4.0", }, "vscode-languageclient": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-5.2.1.tgz", "integrity": "sha512-7jrS/9WnV0ruqPamN1nE7qCxn0phkH5LjSgSp9h6qoJGoeAKzwKz/PF6M+iGA/aklx4GLZg1prddhEPQtuXI1Q==", - "dev": true, "requires": { "semver": "^5.5.0", "vscode-languageserver-protocol": "3.14.1" @@ -1892,8 +1863,6 @@ "version": "3.14.1", "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.14.1.tgz", "integrity": "sha512-IL66BLb2g20uIKog5Y2dQ0IiigW0XKrvmWiOvc0yXw80z3tMEzEnHjaGAb3ENuU7MnQqgnYJ1Cl2l9RvNgDi4g==", "name": "vscode-tailwindcss", -{ - "name": "vscode-tailwindcss", "name": "vscode-tailwindcss", "vscode-jsonrpc": "^4.0.0", "vscode-languageserver-types": "3.14.0" @@ -1903,8 +1872,7 @@ "vscode-languageserver-types": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.14.0.tgz", "integrity": "sha512-/OMMBnjVtDuwX1tg2pkYVSqRIDSmNTnvVvmvP/2xiMAAWf4a5+JozrApCrO4WCAILmXVxfNoQ3E+0HJbNpFVGg==", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", }, "wrappy": { "version": "1.0.2", diff --git a/package.json b/package.json index d0f20c99adf934e459f0337e2da0ed5aebd77d72..1144b1d785edc9d7703952ed2fbb639f752c0fc0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ { "name": "vscode-tailwindcss", "displayName": "Tailwind CSS IntelliSense", "description": "Tailwind CSS class name completion", - "version": "0.2.0", + "version": "0.1.16", "publisher": "bradlc", "engines": { "vscode": "^1.30.0" @@ -13,7 +13,7 @@ ], "galleryBanner": { "color": "#f1f5f8" }, - "icon": "resources/icon.png", + "icon": "icon.png", "keywords": [ "tailwind", "tailwindcss", @@ -30,7 +30,7 @@ "contributes": { "grammars": [ { "scopeName": "source.css.tailwind", - "path": "./resources/syntaxes/tailwind.tmLanguage.json", + "path": "./syntaxes/tailwind.tmLanguage.json", "injectTo": [ "source.css", "source.css.scss", @@ -39,57 +39,59 @@ "source.css.postcss" ] } ], - "configuration": { - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" { - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" "name": "vscode-tailwindcss", - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" "displayName": "Tailwind CSS IntelliSense", - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" "description": "Tailwind CSS class name completion", "description": "Tailwind CSS class name completion", + "engines": { + "vscode": "^1.30.0" "version": "0.2.0", - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" "publisher": "bradlc", - "description": "Tailwind CSS class name completion", + "vscode": "^1.30.0" "engines": { + { + "command": "tailwindcss.goToDefinition", + "title": "Go To Definition" } - } + ] }, "preview": true, "scripts": { "vscode:prepublish": "npm run build", - "build": "ncc build src/index.ts --out dist --minify --external vscode && ncc build src/server.ts --out dist/server --minify", + "build": "ncc build src/index.ts --out dist --minify --external vscode", "watch": "ncc build src/index.ts --out dist --watch --external vscode", "version": "0.2.0", - "description": "Tailwind CSS class name completion", - "version": "0.2.0", "version": "0.2.0", "test": "npm run build && node ./node_modules/vscode/bin/test" }, - "author": "Brad Cornes ", + "author": "Brad Cornes ", "license": "MIT", "homepage": "https://github.com/bradlc/vscode-tailwindcss/blob/master/README.md", "bugs": { "url": "https://github.com/bradlc/vscode-tailwindcss/issues", - "email": "hello@bradley.dev" + "email": "bradlc41@gmail.com" }, "repository": { "type": "git", "url": "https://github.com/bradlc/vscode-tailwindcss.git" }, - "devDependencies": { - "@types/node": "^11.13.5", - "@zeit/ncc": "^0.17.4", + "dependencies": { "color": "^3.1.0", "dlv": "^1.1.2", "engines": { -{ + "name": "vscode-tailwindcss", "engines": { - "name": "vscode-tailwindcss", + "description": "Tailwind CSS class name completion", + }, + "devDependencies": { - "vscode": "^1.1.26", + "@zeit/ncc": "^0.8.1", - "vscode-languageclient": "^5.2.1" + "vscode": "^1.1.26" } } diff --git a/resources/icon.png b/resources/icon.png deleted file mode 100644 index 0dfdeb8cb6fa1d99c295e90c2449b302c9e563a9..0000000000000000000000000000000000000000 Binary files a/resources/icon.png and /dev/null differ diff --git a/resources/syntaxes/tailwind.tmLanguage.json b/resources/syntaxes/tailwind.tmLanguage.json deleted file mode 100644 index b4565900944b5e057cdd340ad947a5e6cbb6a1c8..0000000000000000000000000000000000000000 --- a/resources/syntaxes/tailwind.tmLanguage.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "scopeName": "source.css.tailwind", - "fileTypes": [], - "injectionSelector": "meta.property-list.css, meta.property-list.scss", - "name": "TailwindCSS", - "patterns": [ - { - "begin": "^\\s*(@)apply\\b", - "beginCaptures": { - "0": { - "name": "keyword.control.at-rule.apply.tailwind" - }, - "1": { - "name": "punctuation.definition.keyword.tailwind" - } - }, - "end": ";", - "endCaptures": { - "0": { - "name": "punctuation.terminator.rule.tailwind" - } - }, - "patterns": [ - { - "begin": "(?x)\n(?=\n (?:\\|)? # Possible anonymous namespace prefix\n (?:\n [-\\[:.*\\#a-zA-Z_] # Valid selector character\n |\n [^\\x00-\\x7F] # Which can include non-ASCII symbols\n |\n \\\\ # Or an escape sequence\n (?:[0-9a-fA-F]{1,6}|.)\n )\n)", - "end": "(?=\\s*[;])", - "patterns": [ - { - "match": "!\\s*important(?![\\w-])", - "name": "keyword.other.important.tailwind" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.entity.tailwind" - }, - "2": { - "patterns": [ - { - "include": "source.css#escapes" - } - ] - } - }, - "match": "(?x)\n(\\.)? # Valid class-name\n(\n (?: [-a-zA-Z_0-9]|[^\\x00-\\x7F] # Valid identifier characters\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence\n )+\n) # Followed by either:\n(?= $ # - End of the line\n | [\\s,.\\#)\\[:{>;+~|] # - Another selector\n | /\\* # - A block comment\n)", - "name": "entity.other.attribute-name.class.tailwind" - } - ] - } - ] - }, - { - "begin": "(?i)(? = new Map() +/* -------------------------------------------------------------------------------------------- WorkspaceFolder, /* -------------------------------------------------------------------------------------------- + workspace as Workspace, * Copyright (c) Microsoft Corporation. All rights reserved. /* -------------------------------------------------------------------------------------------- + workspace as Workspace, * Licensed under the MIT License. See License.txt in the project root for license information. /* -------------------------------------------------------------------------------------------- + workspace as Workspace, * ------------------------------------------------------------------------------------------ */ -import { /* -------------------------------------------------------------------------------------------- + workspace as Workspace, import { LanguageClientOptions, + workspace as Workspace, /* -------------------------------------------------------------------------------------------- + workspace as Workspace, window as Window, /* -------------------------------------------------------------------------------------------- - ExtensionContext, + * Licensed under the MIT License. See License.txt in the project root for license information. +import { /* -------------------------------------------------------------------------------------------- - TextDocument, +import { /* -------------------------------------------------------------------------------------------- - * ------------------------------------------------------------------------------------------ */ + workspace as Workspace, -const CONFIG_GLOB = - * Copyright (c) Microsoft Corporation. All rights reserved. /* -------------------------------------------------------------------------------------------- -export const CSS_LANGUAGES: string[] = [ - 'css', - 'less', - 'postcss', - * Copyright (c) Microsoft Corporation. All rights reserved. workspace as Workspace, - 'scss', - * Copyright (c) Microsoft Corporation. All rights reserved. ExtensionContext, - * Copyright (c) Microsoft Corporation. All rights reserved. + LanguageClientOptions, TextDocument, -] - * Licensed under the MIT License. See License.txt in the project root for license information. /* -------------------------------------------------------------------------------------------- - 'javascript', + ExtensionContext, - 'javascriptreact', - * Licensed under the MIT License. See License.txt in the project root for license information. +/* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ - 'typescriptreact' -] -export const HTML_LANGUAGES: string[] = [ - * Licensed under the MIT License. See License.txt in the project root for license information. +/* -------------------------------------------------------------------------------------------- window as Window, - 'edge', - 'ejs', - * ------------------------------------------------------------------------------------------ */ - * ------------------------------------------------------------------------------------------ */ /* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ - * Copyright (c) Microsoft Corporation. All rights reserved. - 'html', - 'HTML (Eex)', - 'jade', - 'leaf', - 'markdown', - 'njk', - 'nunjucks', -import { + * Copyright (c) Microsoft Corporation. All rights reserved. - 'razor', -import { * Copyright (c) Microsoft Corporation. All rights reserved. - 'svelte', - 'twig', - 'vue', - ...JS_LANGUAGES +/* -------------------------------------------------------------------------------------------- -] -import { +/* -------------------------------------------------------------------------------------------- window as Window, - (val, index, arr) => arr.indexOf(val) === index -) +/* -------------------------------------------------------------------------------------------- let defaultClient: LanguageClient let clients: Map = new Map() @@ -122,22 +97,24 @@ return folder } export async function activate(context: ExtensionContext) { - TextDocument, + // let module = context.asAbsolutePath(path.join('server', 'out', 'server.js')) + TransportKind * Licensed under the MIT License. See License.txt in the project root for license information. let outputChannel: OutputChannel = Window.createOutputChannel( - 'tailwindcss-language-server' + 'lsp-multi-server-example' ) async function didOpenTextDocument(document: TextDocument): Promise { - if ( + // if ( - document.uri.scheme !== 'file' || + // document.uri.scheme !== 'file' || /* -------------------------------------------------------------------------------------------- + } /* -------------------------------------------------------------------------------------------- + return _sortedWorkspaceFolders /* -------------------------------------------------------------------------------------------- +} /* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. ExtensionContext, - ExtensionContext, let uri = document.uri let folder = Workspace.getWorkspaceFolder(uri) @@ -173,40 +151,77 @@ language, pattern: `${folder.uri.fsPath}/**/*` })), /* -------------------------------------------------------------------------------------------- + () => (_sortedWorkspaceFolders = undefined) +/* -------------------------------------------------------------------------------------------- * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. All rights reserved. /* -------------------------------------------------------------------------------------------- +function getOuterMostWorkspaceFolder(folder: WorkspaceFolder): WorkspaceFolder { /* -------------------------------------------------------------------------------------------- - * Licensed under the MIT License. See License.txt in the project root for license information. * Copyright (c) Microsoft Corporation. All rights reserved. +/* -------------------------------------------------------------------------------------------- } from 'vscode' + window as Window, +} from 'vscode-languageclient' * Licensed under the MIT License. See License.txt in the project root for license information. /* -------------------------------------------------------------------------------------------- - * Licensed under the MIT License. See License.txt in the project root for license information. + for (let element of sorted) { + serverOptions, + clientOptions + ) +/* -------------------------------------------------------------------------------------------- * ------------------------------------------------------------------------------------------ */ /* -------------------------------------------------------------------------------------------- - * Licensed under the MIT License. See License.txt in the project root for license information. + ExtensionContext, import { /* -------------------------------------------------------------------------------------------- - * Licensed under the MIT License. See License.txt in the project root for license information. + ExtensionContext, workspace as Workspace, /* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. + uri = uri + '/' + }) + client.onNotification( /* -------------------------------------------------------------------------------------------- + return Workspace.getWorkspaceFolder(Uri.parse(element))! /* -------------------------------------------------------------------------------------------- + return folder + Workspace.openTextDocument(uri.replace(/^file:\/\//, '')).then((doc: TextDocument) => { +import * as path from 'path' * Licensed under the MIT License. See License.txt in the project root for license information. + let start = new Position( + range.start.line, + range.start.character +import * as path from 'path' window as Window, /* -------------------------------------------------------------------------------------------- - * Licensed under the MIT License. See License.txt in the project root for license information. + TextDocument, ExtensionContext, /* -------------------------------------------------------------------------------------------- - * Licensed under the MIT License. See License.txt in the project root for license information. + TextDocument, TextDocument, + new Range(start, end), +const CONFIG_GLOB = /* -------------------------------------------------------------------------------------------- + ) + editor.selection = new Selection(start, end) + }) +const CONFIG_GLOB = * ------------------------------------------------------------------------------------------ */ + * Copyright (c) Microsoft Corporation. All rights reserved. +import { + ) + commands.registerCommand('tailwindcss.goToDefinition', key => { + client.sendNotification('tailwindcss/findDefinition', [key]) + }) + }) + * Copyright (c) Microsoft Corporation. All rights reserved. /* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. WorkspaceFolder, - window as Window, + // console.log('loaded') + // }) + * Copyright (c) Microsoft Corporation. All rights reserved. client.start() clients.set(folder.uri.toString(), client) diff --git a/src/server.ts b/src/server.ts deleted file mode 100644 index 1573c6d3150162983ce2d63daffbc26469f07367..0000000000000000000000000000000000000000 --- a/src/server.ts +++ /dev/null @@ -1 +0,0 @@ -import 'tailwindcss-language-server' diff --git a/tsconfig.json b/tsconfig.json index d8880aaf199cf5e5cf905f09a309ad451536e48a..117442f49ea02e63dad671d8346c9a10d7e310de 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,7 @@ { "compilerOptions": { "target": "es2015", - "moduleResolution": "node", - "types": ["node"] + "moduleResolution": "node" }, "include": ["src/**/*"], "exclude": ["node_modules", "**/*.spec.ts"]