UNPKG

@microsoft/compose-language-service

Version:
53 lines 2.84 kB
"use strict"; /*!-------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.PortsCompletionCollection = void 0; /* eslint-disable no-template-curly-in-string */ const vscode_languageserver_1 = require("vscode-languageserver"); const CompletionCollection_1 = require("./CompletionCollection"); // Matches ` - ""` or ` -`, with allowances for other amounts of whitespace/quoting const PortItemStartRegex = /(\s*-\s*)(?<leadingQuote>"|')?\2\s*$/i; exports.PortsCompletionCollection = new CompletionCollection_1.CompletionCollection('ports', { logicalPaths: [/^\/services\/[.\w-]+\/ports\/<item>\/.*$/i], indentationDepth: 3 }, ...[ { matcher: PortItemStartRegex, label: 'containerPort', insertText: '"${1:80}"$0', insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet, isAdvancedComposeCompletion: false, }, { matcher: PortItemStartRegex, label: 'hostPort:containerPort', insertText: '"${1:8080}:${2:80}"$0', insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet, isAdvancedComposeCompletion: true, }, { matcher: PortItemStartRegex, label: 'hostPort:containerPort/protocol', insertText: '"${1:8080}:${2:80}/${3|tcp,udp|}"$0', insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet, isAdvancedComposeCompletion: true, }, { matcher: PortItemStartRegex, label: 'hostRange:containerRange', insertText: '"${1:8080}-${2:8081}:${3:80}-${4:81}"$0', insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet, isAdvancedComposeCompletion: true, }, { matcher: PortItemStartRegex, label: '(Long form port specification)', insertText: 'target: ${1:80}\n published: ${2:8080}\n protocol: ${3|tcp,udp|}\n mode: ${4|host,ingress|}$0', // These are intentionally always two spaces, not the auto-replaced tabs; this is a flow map and must align to the first item which is after `- ` insertTextFormat: vscode_languageserver_1.InsertTextFormat.Snippet, insertTextMode: vscode_languageserver_1.InsertTextMode.adjustIndentation, isAdvancedComposeCompletion: true, documentation: 'target: <containerPort>\n published: <hostPort>\n protocol: <udp, tcp>\n mode: <host, ingress>', sortText: 'zzz', // Force this to sort to the bottom }, ]); //# sourceMappingURL=PortsCompletionCollection.js.map