forked from qt-creator/qt-creator
LSP: Avoid running strlen() on json keys
This feels better when stepping through the code but doesn't really make a difference in the profile. Change-Id: I2c30578bf1e990b039caadb8b8ce532f009b775d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -636,7 +636,7 @@ public:
|
||||
void clearWorkDoneProgress() { remove(workDoneProgressKey); }
|
||||
|
||||
private:
|
||||
constexpr static const char workDoneProgressKey[] = "workDoneProgress";
|
||||
constexpr static const Key workDoneProgressKey{"workDoneProgress"};
|
||||
};
|
||||
|
||||
class LANGUAGESERVERPROTOCOL_EXPORT ClientCapabilities : public JsonObject
|
||||
|
@@ -3,229 +3,233 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLatin1StringView>
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
||||
constexpr char actionsKey[] = "actions";
|
||||
constexpr char activeParameterKey[] = "activeParameter";
|
||||
constexpr char activeParameterSupportKey[] = "activeParameterSupport";
|
||||
constexpr char activeSignatureKey[] = "activeSignature";
|
||||
constexpr char addedKey[] = "added";
|
||||
constexpr char additionalTextEditsKey[] = "additionalTextEdits";
|
||||
constexpr char alphaKey[] = "alpha";
|
||||
constexpr char appliedKey[] = "applied";
|
||||
constexpr char applyEditKey[] = "applyEdit";
|
||||
constexpr char argumentsKey[] = "arguments";
|
||||
constexpr char blueKey[] = "blue";
|
||||
constexpr char callHierarchyKey[] = "callHierarchy";
|
||||
constexpr char callHierarchyProviderKey[] = "callHierarchyProvider";
|
||||
constexpr char cancellableKey[] = "cancellable";
|
||||
constexpr char capabilitiesKey[] = "capabilities";
|
||||
constexpr char chKey[] = "ch";
|
||||
constexpr char changeKey[] = "change";
|
||||
constexpr char changeNotificationsKey[] = "changeNotifications";
|
||||
constexpr char changesKey[] = "changes";
|
||||
constexpr char characterKey[] = "character";
|
||||
constexpr char childrenKey[] = "children";
|
||||
constexpr char clientInfoKey[] = "clientInfo";
|
||||
constexpr char codeActionKey[] = "codeAction";
|
||||
constexpr char codeActionKindKey[] = "codeActionKind";
|
||||
constexpr char codeActionKindsKey[] = "codeActionKinds";
|
||||
constexpr char codeActionLiteralSupportKey[] = "codeActionLiteralSupport";
|
||||
constexpr char codeActionProviderKey[] = "codeActionProvider";
|
||||
constexpr char codeKey[] = "code";
|
||||
constexpr char codeLensKey[] = "codeLens";
|
||||
constexpr char codeLensProviderKey[] = "codeLensProvider";
|
||||
constexpr char colorInfoKey[] = "colorInfo";
|
||||
constexpr char colorKey[] = "color";
|
||||
constexpr char colorProviderKey[] = "colorProvider";
|
||||
constexpr char commandKey[] = "command";
|
||||
constexpr char commandsKey[] = "commands";
|
||||
constexpr char commitCharacterSupportKey[] = "commitCharacterSupport";
|
||||
constexpr char commitCharactersKey[] = "commitCharacters";
|
||||
constexpr char completionItemKey[] = "completionItem";
|
||||
constexpr char completionItemKindKey[] = "completionItemKind";
|
||||
constexpr char completionKey[] = "completion";
|
||||
constexpr char completionProviderKey[] = "completionProvider";
|
||||
constexpr char configurationKey[] = "configuration";
|
||||
constexpr char containerNameKey[] = "containerName";
|
||||
constexpr char contentChangesKey[] = "contentChanges";
|
||||
constexpr char contentFormatKey[] = "contentFormat";
|
||||
constexpr char contentKey[] = "value";
|
||||
constexpr char contentsKey[] = "contents";
|
||||
constexpr char contextKey[] = "context";
|
||||
constexpr char contextSupportKey[] = "contextSupport";
|
||||
constexpr char dataKey[] = "data";
|
||||
constexpr char definitionKey[] = "definition";
|
||||
constexpr char definitionProviderKey[] = "definitionProvider";
|
||||
constexpr char deleteCountKey[] = "deleteCount";
|
||||
constexpr char deltaKey[] = "delta";
|
||||
constexpr char deprecatedKey[] = "deprecated";
|
||||
constexpr char detailKey[] = "detail";
|
||||
constexpr char diagnosticsKey[] = "diagnostics";
|
||||
constexpr char didChangeConfigurationKey[] = "didChangeConfiguration";
|
||||
constexpr char didChangeWatchedFilesKey[] = "didChangeWatchedFiles";
|
||||
constexpr char didSaveKey[] = "didSave";
|
||||
constexpr char documentChangesKey[] = "documentChanges";
|
||||
constexpr char documentFormattingProviderKey[] = "documentFormattingProvider";
|
||||
constexpr char documentHighlightKey[] = "documentHighlight";
|
||||
constexpr char documentHighlightProviderKey[] = "documentHighlightProvider";
|
||||
constexpr char documentLinkKey[] = "documentLink";
|
||||
constexpr char documentLinkProviderKey[] = "documentLinkProvider";
|
||||
constexpr char documentRangeFormattingProviderKey[] = "documentRangeFormattingProvider";
|
||||
constexpr char documentSelectorKey[] = "documentSelector";
|
||||
constexpr char documentSymbolKey[] = "documentSymbol";
|
||||
constexpr char documentSymbolProviderKey[] = "documentSymbolProvider";
|
||||
constexpr char documentationFormatKey[] = "documentationFormat";
|
||||
constexpr char documentationKey[] = "documentation";
|
||||
constexpr char dynamicRegistrationKey[] = "dynamicRegistration";
|
||||
constexpr char editKey[] = "edit";
|
||||
constexpr char editsKey[] = "edits";
|
||||
constexpr char endKey[] = "end";
|
||||
constexpr char errorKey[] = "error";
|
||||
constexpr char eventKey[] = "event";
|
||||
constexpr char executeCommandKey[] = "executeCommand";
|
||||
constexpr char executeCommandProviderKey[] = "executeCommandProvider";
|
||||
constexpr char experimentalKey[] = "experimental";
|
||||
constexpr char filterTextKey[] = "filterText";
|
||||
constexpr char firstTriggerCharacterKey[] = "firstTriggerCharacter";
|
||||
constexpr char formatsKey[] = "formats";
|
||||
constexpr char formattingKey[] = "formatting";
|
||||
constexpr char fromKey[] = "from";
|
||||
constexpr char fromRangesKey[] = "fromRanges";
|
||||
constexpr char fullKey[] = "full";
|
||||
constexpr char greenKey[] = "green";
|
||||
constexpr char hierarchicalDocumentSymbolSupportKey[] = "hierarchicalDocumentSymbolSupport";
|
||||
constexpr char hoverKey[] = "hover";
|
||||
constexpr char hoverProviderKey[] = "hoverProvider";
|
||||
constexpr char idKey[] = "id";
|
||||
constexpr char ignoreIfExistsKey[] = "ignoreIfExists";
|
||||
constexpr char ignoreIfNotExistsKey[] = "ignoreIfNotExists";
|
||||
constexpr char implementationKey[] = "implementation";
|
||||
constexpr char implementationProviderKey[] = "implementationProvider";
|
||||
constexpr char includeDeclarationKey[] = "includeDeclaration";
|
||||
constexpr char includeTextKey[] = "includeText";
|
||||
constexpr char initializationOptionsKey[] = "initializationOptions";
|
||||
constexpr char insertFinalNewlineKey[] = "insertFinalNewline";
|
||||
constexpr char insertSpaceKey[] = "insertSpace";
|
||||
constexpr char insertTextFormatKey[] = "insertTextFormat";
|
||||
constexpr char insertTextKey[] = "insertText";
|
||||
constexpr char isIncompleteKey[] = "isIncomplete";
|
||||
constexpr char itemKey[] = "item";
|
||||
constexpr char itemsKey[] = "items";
|
||||
constexpr char jsonRpcVersionKey[] = "jsonrpc";
|
||||
constexpr char kindKey[] = "kind";
|
||||
constexpr char labelKey[] = "label";
|
||||
constexpr char languageIdKey[] = "languageId";
|
||||
constexpr char languageKey[] = "language";
|
||||
constexpr char legendKey[] = "legend";
|
||||
constexpr char limitKey[] = "limit";
|
||||
constexpr char lineKey[] = "line";
|
||||
constexpr char linesKey[] = "lines";
|
||||
constexpr char locationKey[] = "location";
|
||||
constexpr char messageKey[] = "message";
|
||||
constexpr char methodKey[] = "method";
|
||||
constexpr char moreTriggerCharacterKey[] = "moreTriggerCharacter";
|
||||
constexpr char multiLineTokenSupportKey[] = "multiLineTokenSupport";
|
||||
constexpr char nameKey[] = "name";
|
||||
constexpr char newNameKey[] = "newName";
|
||||
constexpr char newTextKey[] = "newText";
|
||||
constexpr char newUriKey[] = "newUri";
|
||||
constexpr char oldUriKey[] = "oldUri";
|
||||
constexpr char onTypeFormattingKey[] = "onTypeFormatting";
|
||||
constexpr char onlyKey[] = "only";
|
||||
constexpr char openCloseKey[] = "openClose";
|
||||
constexpr char optionsKey[] = "options";
|
||||
constexpr char overlappingTokenSupportKey[] = "overlappingTokenSupport";
|
||||
constexpr char overwriteKey[] = "overwrite";
|
||||
constexpr char parametersKey[] = "parameters";
|
||||
constexpr char paramsKey[] = "params";
|
||||
constexpr char patternKey[] = "pattern";
|
||||
constexpr char percentageKey[] = "percentage";
|
||||
constexpr char placeHolderKey[] = "placeHolder";
|
||||
constexpr char positionKey[] = "position";
|
||||
constexpr char prepareProviderKey[] = "prepareProvider";
|
||||
constexpr char prepareSupportKey[] = "prepareSupport";
|
||||
constexpr char previousResultIdKey[] = "previousResultId";
|
||||
constexpr char processIdKey[] = "processId";
|
||||
constexpr char queryKey[] = "query";
|
||||
constexpr char rangeFormattingKey[] = "rangeFormatting";
|
||||
constexpr char rangeKey[] = "range";
|
||||
constexpr char rangeLengthKey[] = "rangeLength";
|
||||
constexpr char reasonKey[] = "reason";
|
||||
constexpr char recursiveKey[] = "recursive";
|
||||
constexpr char redKey[] = "red";
|
||||
constexpr char referencesKey[] = "references";
|
||||
constexpr char referencesProviderKey[] = "referencesProvider";
|
||||
constexpr char refreshSupportKey[] = "refreshSupport";
|
||||
constexpr char registerOptionsKey[] = "registerOptions";
|
||||
constexpr char registrationsKey[] = "registrations";
|
||||
constexpr char removedKey[] = "removed";
|
||||
constexpr char renameKey[] = "rename";
|
||||
constexpr char renameProviderKey[] = "renameProvider";
|
||||
constexpr char requestsKey[] = "requests";
|
||||
constexpr char resolveProviderKey[] = "resolveProvider";
|
||||
constexpr char resourceOperationsKey[] = "resourceOperations";
|
||||
constexpr char resultIdKey[] = "resultId";
|
||||
constexpr char resultKey[] = "result";
|
||||
constexpr char retryKey[] = "retry";
|
||||
constexpr char rootPathKey[] = "rootPath";
|
||||
constexpr char rootUriKey[] = "rootUri";
|
||||
constexpr char saveKey[] = "save";
|
||||
constexpr char schemeKey[] = "scheme";
|
||||
constexpr char scopeUriKey[] = "scopeUri";
|
||||
constexpr char sectionKey[] = "section";
|
||||
constexpr char selectionRangeKey[] = "selectionRange";
|
||||
constexpr char semanticTokensKey[] = "semanticTokens";
|
||||
constexpr char semanticTokensProviderKey[] = "semanticTokensProvider";
|
||||
constexpr char serverInfoKey[] = "serverInfo";
|
||||
constexpr char settingsKey[] = "settings";
|
||||
constexpr char severityKey[] = "severity";
|
||||
constexpr char signatureHelpKey[] = "signatureHelp";
|
||||
constexpr char signatureHelpProviderKey[] = "signatureHelpProvider";
|
||||
constexpr char signatureInformationKey[] = "signatureInformation";
|
||||
constexpr char signaturesKey[] = "signatures";
|
||||
constexpr char snippetSupportKey[] = "snippetSupport";
|
||||
constexpr char sortTextKey[] = "sortText";
|
||||
constexpr char sourceKey[] = "source";
|
||||
constexpr char startKey[] = "start";
|
||||
constexpr char supportedKey[] = "supported";
|
||||
constexpr char symbolKey[] = "symbol";
|
||||
constexpr char symbolKindKey[] = "symbolKind";
|
||||
constexpr char syncKindKey[] = "syncKind";
|
||||
constexpr char synchronizationKey[] = "synchronization";
|
||||
constexpr char tabSizeKey[] = "tabSize";
|
||||
constexpr char tagsKey[] = "tags";
|
||||
constexpr char targetKey[] = "target";
|
||||
constexpr char textDocumentKey[] = "textDocument";
|
||||
constexpr char textDocumentSyncKey[] = "textDocumentSync";
|
||||
constexpr char textEditKey[] = "textEdit";
|
||||
constexpr char textKey[] = "text";
|
||||
constexpr char titleKey[] = "title";
|
||||
constexpr char toKey[] = "to";
|
||||
constexpr char tokenKey[] = "token";
|
||||
constexpr char tokenModifiersKey[] = "tokenModifiers";
|
||||
constexpr char tokenTypesKey[] = "tokenTypes";
|
||||
constexpr char traceKey[] = "trace";
|
||||
constexpr char triggerCharacterKey[] = "triggerCharacter";
|
||||
constexpr char triggerCharactersKey[] = "triggerCharacters";
|
||||
constexpr char triggerKindKey[] = "triggerKind";
|
||||
constexpr char trimFinalNewlinesKey[] = "trimFinalNewlines";
|
||||
constexpr char trimTrailingWhitespaceKey[] = "trimTrailingWhitespace";
|
||||
constexpr char typeDefinitionKey[] = "typeDefinition";
|
||||
constexpr char typeDefinitionProviderKey[] = "typeDefinitionProvider";
|
||||
constexpr char typeKey[] = "type";
|
||||
constexpr char unregistrationsKey[] = "unregistrations";
|
||||
constexpr char uriKey[] = "uri";
|
||||
constexpr char valueKey[] = "value";
|
||||
constexpr char valueSetKey[] = "valueSet";
|
||||
constexpr char versionKey[] = "version";
|
||||
constexpr char willSaveKey[] = "willSave";
|
||||
constexpr char willSaveWaitUntilKey[] = "willSaveWaitUntil";
|
||||
constexpr char windowKey[] = "window";
|
||||
constexpr char workDoneProgressKey[] = "workDoneProgress";
|
||||
constexpr char workspaceEditKey[] = "workspaceEdit";
|
||||
constexpr char workspaceFoldersKey[] = "workspaceFolders";
|
||||
constexpr char workspaceKey[] = "workspace";
|
||||
constexpr char workspaceSymbolProviderKey[] = "workspaceSymbolProvider";
|
||||
using Key = QLatin1StringView;
|
||||
|
||||
constexpr Key actionsKey{"actions"};
|
||||
constexpr Key activeParameterKey{"activeParameter"};
|
||||
constexpr Key activeParameterSupportKey{"activeParameterSupport"};
|
||||
constexpr Key activeSignatureKey{"activeSignature"};
|
||||
constexpr Key addedKey{"added"};
|
||||
constexpr Key additionalTextEditsKey{"additionalTextEdits"};
|
||||
constexpr Key alphaKey{"alpha"};
|
||||
constexpr Key appliedKey{"applied"};
|
||||
constexpr Key applyEditKey{"applyEdit"};
|
||||
constexpr Key argumentsKey{"arguments"};
|
||||
constexpr Key blueKey{"blue"};
|
||||
constexpr Key callHierarchyKey{"callHierarchy"};
|
||||
constexpr Key callHierarchyProviderKey{"callHierarchyProvider"};
|
||||
constexpr Key cancellableKey{"cancellable"};
|
||||
constexpr Key capabilitiesKey{"capabilities"};
|
||||
constexpr Key chKey{"ch"};
|
||||
constexpr Key changeKey{"change"};
|
||||
constexpr Key changeNotificationsKey{"changeNotifications"};
|
||||
constexpr Key changesKey{"changes"};
|
||||
constexpr Key characterKey{"character"};
|
||||
constexpr Key childrenKey{"children"};
|
||||
constexpr Key clientInfoKey{"clientInfo"};
|
||||
constexpr Key codeActionKey{"codeAction"};
|
||||
constexpr Key codeActionKindKey{"codeActionKind"};
|
||||
constexpr Key codeActionKindsKey{"codeActionKinds"};
|
||||
constexpr Key codeActionLiteralSupportKey{"codeActionLiteralSupport"};
|
||||
constexpr Key codeActionProviderKey{"codeActionProvider"};
|
||||
constexpr Key codeKey{"code"};
|
||||
constexpr Key codeLensKey{"codeLens"};
|
||||
constexpr Key codeLensProviderKey{"codeLensProvider"};
|
||||
constexpr Key colorInfoKey{"colorInfo"};
|
||||
constexpr Key colorKey{"color"};
|
||||
constexpr Key colorProviderKey{"colorProvider"};
|
||||
constexpr Key commandKey{"command"};
|
||||
constexpr Key commandsKey{"commands"};
|
||||
constexpr Key commitCharacterSupportKey{"commitCharacterSupport"};
|
||||
constexpr Key commitCharactersKey{"commitCharacters"};
|
||||
constexpr Key completionItemKey{"completionItem"};
|
||||
constexpr Key completionItemKindKey{"completionItemKind"};
|
||||
constexpr Key completionKey{"completion"};
|
||||
constexpr Key completionProviderKey{"completionProvider"};
|
||||
constexpr Key configurationKey{"configuration"};
|
||||
constexpr Key containerNameKey{"containerName"};
|
||||
constexpr Key contentChangesKey{"contentChanges"};
|
||||
constexpr Key contentFormatKey{"contentFormat"};
|
||||
constexpr Key contentKey{"value"};
|
||||
constexpr Key contentsKey{"contents"};
|
||||
constexpr Key contextKey{"context"};
|
||||
constexpr Key contextSupportKey{"contextSupport"};
|
||||
constexpr Key dataKey{"data"};
|
||||
constexpr Key definitionKey{"definition"};
|
||||
constexpr Key definitionProviderKey{"definitionProvider"};
|
||||
constexpr Key deleteCountKey{"deleteCount"};
|
||||
constexpr Key deltaKey{"delta"};
|
||||
constexpr Key deprecatedKey{"deprecated"};
|
||||
constexpr Key detailKey{"detail"};
|
||||
constexpr Key diagnosticsKey{"diagnostics"};
|
||||
constexpr Key didChangeConfigurationKey{"didChangeConfiguration"};
|
||||
constexpr Key didChangeWatchedFilesKey{"didChangeWatchedFiles"};
|
||||
constexpr Key didSaveKey{"didSave"};
|
||||
constexpr Key documentChangesKey{"documentChanges"};
|
||||
constexpr Key documentFormattingProviderKey{"documentFormattingProvider"};
|
||||
constexpr Key documentHighlightKey{"documentHighlight"};
|
||||
constexpr Key documentHighlightProviderKey{"documentHighlightProvider"};
|
||||
constexpr Key documentLinkKey{"documentLink"};
|
||||
constexpr Key documentLinkProviderKey{"documentLinkProvider"};
|
||||
constexpr Key documentRangeFormattingProviderKey{"documentRangeFormattingProvider"};
|
||||
constexpr Key documentSelectorKey{"documentSelector"};
|
||||
constexpr Key documentSymbolKey{"documentSymbol"};
|
||||
constexpr Key documentSymbolProviderKey{"documentSymbolProvider"};
|
||||
constexpr Key documentationFormatKey{"documentationFormat"};
|
||||
constexpr Key documentationKey{"documentation"};
|
||||
constexpr Key dynamicRegistrationKey{"dynamicRegistration"};
|
||||
constexpr Key editKey{"edit"};
|
||||
constexpr Key editsKey{"edits"};
|
||||
constexpr Key endKey{"end"};
|
||||
constexpr Key errorKey{"error"};
|
||||
constexpr Key eventKey{"event"};
|
||||
constexpr Key executeCommandKey{"executeCommand"};
|
||||
constexpr Key executeCommandProviderKey{"executeCommandProvider"};
|
||||
constexpr Key experimentalKey{"experimental"};
|
||||
constexpr Key filterTextKey{"filterText"};
|
||||
constexpr Key firstTriggerCharacterKey{"firstTriggerCharacter"};
|
||||
constexpr Key formatsKey{"formats"};
|
||||
constexpr Key formattingKey{"formatting"};
|
||||
constexpr Key fromKey{"from"};
|
||||
constexpr Key fromRangesKey{"fromRanges"};
|
||||
constexpr Key fullKey{"full"};
|
||||
constexpr Key greenKey{"green"};
|
||||
constexpr Key hierarchicalDocumentSymbolSupportKey{"hierarchicalDocumentSymbolSupport"};
|
||||
constexpr Key hoverKey{"hover"};
|
||||
constexpr Key hoverProviderKey{"hoverProvider"};
|
||||
constexpr Key idKey{"id"};
|
||||
constexpr Key ignoreIfExistsKey{"ignoreIfExists"};
|
||||
constexpr Key ignoreIfNotExistsKey{"ignoreIfNotExists"};
|
||||
constexpr Key implementationKey{"implementation"};
|
||||
constexpr Key implementationProviderKey{"implementationProvider"};
|
||||
constexpr Key includeDeclarationKey{"includeDeclaration"};
|
||||
constexpr Key includeTextKey{"includeText"};
|
||||
constexpr Key initializationOptionsKey{"initializationOptions"};
|
||||
constexpr Key insertFinalNewlineKey{"insertFinalNewline"};
|
||||
constexpr Key insertSpaceKey{"insertSpace"};
|
||||
constexpr Key insertTextFormatKey{"insertTextFormat"};
|
||||
constexpr Key insertTextKey{"insertText"};
|
||||
constexpr Key isIncompleteKey{"isIncomplete"};
|
||||
constexpr Key itemKey{"item"};
|
||||
constexpr Key itemsKey{"items"};
|
||||
constexpr Key jsonRpcVersionKey{"jsonrpc"};
|
||||
constexpr Key kindKey{"kind"};
|
||||
constexpr Key labelKey{"label"};
|
||||
constexpr Key languageIdKey{"languageId"};
|
||||
constexpr Key languageKey{"language"};
|
||||
constexpr Key legendKey{"legend"};
|
||||
constexpr Key limitKey{"limit"};
|
||||
constexpr Key lineKey{"line"};
|
||||
constexpr Key linesKey{"lines"};
|
||||
constexpr Key locationKey{"location"};
|
||||
constexpr Key messageKey{"message"};
|
||||
constexpr Key methodKey{"method"};
|
||||
constexpr Key moreTriggerCharacterKey{"moreTriggerCharacter"};
|
||||
constexpr Key multiLineTokenSupportKey{"multiLineTokenSupport"};
|
||||
constexpr Key nameKey{"name"};
|
||||
constexpr Key newNameKey{"newName"};
|
||||
constexpr Key newTextKey{"newText"};
|
||||
constexpr Key newUriKey{"newUri"};
|
||||
constexpr Key oldUriKey{"oldUri"};
|
||||
constexpr Key onTypeFormattingKey{"onTypeFormatting"};
|
||||
constexpr Key onlyKey{"only"};
|
||||
constexpr Key openCloseKey{"openClose"};
|
||||
constexpr Key optionsKey{"options"};
|
||||
constexpr Key overlappingTokenSupportKey{"overlappingTokenSupport"};
|
||||
constexpr Key overwriteKey{"overwrite"};
|
||||
constexpr Key parametersKey{"parameters"};
|
||||
constexpr Key paramsKey{"params"};
|
||||
constexpr Key patternKey{"pattern"};
|
||||
constexpr Key percentageKey{"percentage"};
|
||||
constexpr Key placeHolderKey{"placeHolder"};
|
||||
constexpr Key positionKey{"position"};
|
||||
constexpr Key prepareProviderKey{"prepareProvider"};
|
||||
constexpr Key prepareSupportKey{"prepareSupport"};
|
||||
constexpr Key previousResultIdKey{"previousResultId"};
|
||||
constexpr Key processIdKey{"processId"};
|
||||
constexpr Key queryKey{"query"};
|
||||
constexpr Key rangeFormattingKey{"rangeFormatting"};
|
||||
constexpr Key rangeKey{"range"};
|
||||
constexpr Key rangeLengthKey{"rangeLength"};
|
||||
constexpr Key reasonKey{"reason"};
|
||||
constexpr Key recursiveKey{"recursive"};
|
||||
constexpr Key redKey{"red"};
|
||||
constexpr Key referencesKey{"references"};
|
||||
constexpr Key referencesProviderKey{"referencesProvider"};
|
||||
constexpr Key refreshSupportKey{"refreshSupport"};
|
||||
constexpr Key registerOptionsKey{"registerOptions"};
|
||||
constexpr Key registrationsKey{"registrations"};
|
||||
constexpr Key removedKey{"removed"};
|
||||
constexpr Key renameKey{"rename"};
|
||||
constexpr Key renameProviderKey{"renameProvider"};
|
||||
constexpr Key requestsKey{"requests"};
|
||||
constexpr Key resolveProviderKey{"resolveProvider"};
|
||||
constexpr Key resourceOperationsKey{"resourceOperations"};
|
||||
constexpr Key resultIdKey{"resultId"};
|
||||
constexpr Key resultKey{"result"};
|
||||
constexpr Key retryKey{"retry"};
|
||||
constexpr Key rootPathKey{"rootPath"};
|
||||
constexpr Key rootUriKey{"rootUri"};
|
||||
constexpr Key saveKey{"save"};
|
||||
constexpr Key schemeKey{"scheme"};
|
||||
constexpr Key scopeUriKey{"scopeUri"};
|
||||
constexpr Key sectionKey{"section"};
|
||||
constexpr Key selectionRangeKey{"selectionRange"};
|
||||
constexpr Key semanticTokensKey{"semanticTokens"};
|
||||
constexpr Key semanticTokensProviderKey{"semanticTokensProvider"};
|
||||
constexpr Key serverInfoKey{"serverInfo"};
|
||||
constexpr Key settingsKey{"settings"};
|
||||
constexpr Key severityKey{"severity"};
|
||||
constexpr Key signatureHelpKey{"signatureHelp"};
|
||||
constexpr Key signatureHelpProviderKey{"signatureHelpProvider"};
|
||||
constexpr Key signatureInformationKey{"signatureInformation"};
|
||||
constexpr Key signaturesKey{"signatures"};
|
||||
constexpr Key snippetSupportKey{"snippetSupport"};
|
||||
constexpr Key sortTextKey{"sortText"};
|
||||
constexpr Key sourceKey{"source"};
|
||||
constexpr Key startKey{"start"};
|
||||
constexpr Key supportedKey{"supported"};
|
||||
constexpr Key symbolKey{"symbol"};
|
||||
constexpr Key symbolKindKey{"symbolKind"};
|
||||
constexpr Key syncKindKey{"syncKind"};
|
||||
constexpr Key synchronizationKey{"synchronization"};
|
||||
constexpr Key tabSizeKey{"tabSize"};
|
||||
constexpr Key tagsKey{"tags"};
|
||||
constexpr Key targetKey{"target"};
|
||||
constexpr Key textDocumentKey{"textDocument"};
|
||||
constexpr Key textDocumentSyncKey{"textDocumentSync"};
|
||||
constexpr Key textEditKey{"textEdit"};
|
||||
constexpr Key textKey{"text"};
|
||||
constexpr Key titleKey{"title"};
|
||||
constexpr Key toKey{"to"};
|
||||
constexpr Key tokenKey{"token"};
|
||||
constexpr Key tokenModifiersKey{"tokenModifiers"};
|
||||
constexpr Key tokenTypesKey{"tokenTypes"};
|
||||
constexpr Key traceKey{"trace"};
|
||||
constexpr Key triggerCharacterKey{"triggerCharacter"};
|
||||
constexpr Key triggerCharactersKey{"triggerCharacters"};
|
||||
constexpr Key triggerKindKey{"triggerKind"};
|
||||
constexpr Key trimFinalNewlinesKey{"trimFinalNewlines"};
|
||||
constexpr Key trimTrailingWhitespaceKey{"trimTrailingWhitespace"};
|
||||
constexpr Key typeDefinitionKey{"typeDefinition"};
|
||||
constexpr Key typeDefinitionProviderKey{"typeDefinitionProvider"};
|
||||
constexpr Key typeKey{"type"};
|
||||
constexpr Key unregistrationsKey{"unregistrations"};
|
||||
constexpr Key uriKey{"uri"};
|
||||
constexpr Key valueKey{"value"};
|
||||
constexpr Key valueSetKey{"valueSet"};
|
||||
constexpr Key versionKey{"version"};
|
||||
constexpr Key willSaveKey{"willSave"};
|
||||
constexpr Key willSaveWaitUntilKey{"willSaveWaitUntil"};
|
||||
constexpr Key windowKey{"window"};
|
||||
constexpr Key workDoneProgressKey{"workDoneProgress"};
|
||||
constexpr Key workspaceEditKey{"workspaceEdit"};
|
||||
constexpr Key workspaceFoldersKey{"workspaceFolders"};
|
||||
constexpr Key workspaceKey{"workspace"};
|
||||
constexpr Key workspaceSymbolProviderKey{"workspaceSymbolProvider"};
|
||||
|
||||
} // namespace LanguageServerProtocol
|
||||
|
@@ -15,14 +15,14 @@ JsonObject &JsonObject::operator=(JsonObject &&other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
QJsonObject::iterator JsonObject::insert(const std::string_view key, const JsonObject &object)
|
||||
QJsonObject::iterator JsonObject::insert(const Key key, const JsonObject &object)
|
||||
{
|
||||
return m_jsonObject.insert(QLatin1String(key.data()), object.m_jsonObject);
|
||||
return m_jsonObject.insert(key, object.m_jsonObject);
|
||||
}
|
||||
|
||||
QJsonObject::iterator JsonObject::insert(const std::string_view key, const QJsonValue &value)
|
||||
QJsonObject::iterator JsonObject::insert(const Key key, const QJsonValue &value)
|
||||
{
|
||||
return m_jsonObject.insert(QLatin1String(key.data()), value);
|
||||
return m_jsonObject.insert(key, value);
|
||||
}
|
||||
|
||||
} // namespace LanguageServerProtocol
|
||||
|
@@ -43,98 +43,99 @@ public:
|
||||
const_iterator end() const { return m_jsonObject.end(); }
|
||||
|
||||
protected:
|
||||
iterator insert(const std::string_view key, const JsonObject &value);
|
||||
iterator insert(const std::string_view key, const QJsonValue &value);
|
||||
using Key = QLatin1StringView;
|
||||
iterator insert(const Key key, const JsonObject &value);
|
||||
iterator insert(const Key key, const QJsonValue &value);
|
||||
|
||||
template <typename T, typename V>
|
||||
iterator insertVariant(const std::string_view key, const V &variant);
|
||||
iterator insertVariant(const Key key, const V &variant);
|
||||
template <typename T1, typename T2, typename... Args, typename V>
|
||||
iterator insertVariant(const std::string_view key, const V &variant);
|
||||
iterator insertVariant(const Key key, const V &variant);
|
||||
|
||||
// QJSonObject redirections
|
||||
QJsonValue value(const std::string_view key) const { return m_jsonObject.value(QLatin1String(key.data())); }
|
||||
bool contains(const std::string_view key) const { return m_jsonObject.contains(QLatin1String(key.data())); }
|
||||
iterator find(const std::string_view key) { return m_jsonObject.find(QLatin1String(key.data())); }
|
||||
const_iterator find(const std::string_view key) const { return m_jsonObject.find(QLatin1String(key.data())); }
|
||||
void remove(const std::string_view key) { m_jsonObject.remove(QLatin1String(key.data())); }
|
||||
QJsonValue value(const QString &key) const { return m_jsonObject.value(key); }
|
||||
QJsonValue value(const Key key) const { return m_jsonObject.value(key); }
|
||||
bool contains(const Key key) const { return m_jsonObject.contains(key); }
|
||||
iterator find(const Key key) { return m_jsonObject.find(key); }
|
||||
const_iterator find(const Key key) const { return m_jsonObject.find(key); }
|
||||
void remove(const Key key) { m_jsonObject.remove(key); }
|
||||
QStringList keys() const { return m_jsonObject.keys(); }
|
||||
|
||||
// convenience value access
|
||||
template<typename T>
|
||||
T typedValue(const std::string_view key) const;
|
||||
T typedValue(const Key key) const;
|
||||
template<typename T>
|
||||
std::optional<T> optionalValue(const std::string_view key) const;
|
||||
std::optional<T> optionalValue(const Key key) const;
|
||||
template<typename T>
|
||||
LanguageClientValue<T> clientValue(const std::string_view key) const;
|
||||
LanguageClientValue<T> clientValue(const Key key) const;
|
||||
template<typename T>
|
||||
std::optional<LanguageClientValue<T>> optionalClientValue(const std::string_view key) const;
|
||||
std::optional<LanguageClientValue<T>> optionalClientValue(const Key key) const;
|
||||
template<typename T>
|
||||
QList<T> array(const std::string_view key) const;
|
||||
QList<T> array(const Key key) const;
|
||||
template<typename T>
|
||||
std::optional<QList<T>> optionalArray(const std::string_view key) const;
|
||||
std::optional<QList<T>> optionalArray(const Key key) const;
|
||||
template<typename T>
|
||||
LanguageClientArray<T> clientArray(const std::string_view key) const;
|
||||
LanguageClientArray<T> clientArray(const Key key) const;
|
||||
template<typename T>
|
||||
std::optional<LanguageClientArray<T>> optionalClientArray(const std::string_view key) const;
|
||||
std::optional<LanguageClientArray<T>> optionalClientArray(const Key key) const;
|
||||
template<typename T>
|
||||
void insertArray(const std::string_view key, const QList<T> &array);
|
||||
void insertArray(const Key key, const QList<T> &array);
|
||||
template<typename>
|
||||
void insertArray(const std::string_view key, const QList<JsonObject> &array);
|
||||
void insertArray(const Key key, const QList<JsonObject> &array);
|
||||
|
||||
private:
|
||||
QJsonObject m_jsonObject;
|
||||
};
|
||||
|
||||
template<typename T, typename V>
|
||||
JsonObject::iterator JsonObject::insertVariant(const std::string_view key, const V &variant)
|
||||
JsonObject::iterator JsonObject::insertVariant(const Key key, const V &variant)
|
||||
{
|
||||
return std::holds_alternative<T>(variant) ? insert(key, std::get<T>(variant)) : end();
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename... Args, typename V>
|
||||
JsonObject::iterator JsonObject::insertVariant(const std::string_view key, const V &variant)
|
||||
JsonObject::iterator JsonObject::insertVariant(const Key key, const V &variant)
|
||||
{
|
||||
auto result = insertVariant<T1>(key, variant);
|
||||
return result != end() ? result : insertVariant<T2, Args...>(key, variant);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T JsonObject::typedValue(const std::string_view key) const
|
||||
T JsonObject::typedValue(const Key key) const
|
||||
{
|
||||
return fromJsonValue<T>(value(key));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::optional<T> JsonObject::optionalValue(const std::string_view key) const
|
||||
std::optional<T> JsonObject::optionalValue(const Key key) const
|
||||
{
|
||||
const QJsonValue &val = value(key);
|
||||
return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue<T>(val));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
LanguageClientValue<T> JsonObject::clientValue(const std::string_view key) const
|
||||
LanguageClientValue<T> JsonObject::clientValue(const Key key) const
|
||||
{
|
||||
return LanguageClientValue<T>(value(key));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::optional<LanguageClientValue<T>> JsonObject::optionalClientValue(const std::string_view key) const
|
||||
std::optional<LanguageClientValue<T>> JsonObject::optionalClientValue(const Key key) const
|
||||
{
|
||||
return contains(key) ? std::make_optional(clientValue<T>(key)) : std::nullopt;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QList<T> JsonObject::array(const std::string_view key) const
|
||||
QList<T> JsonObject::array(const Key key) const
|
||||
{
|
||||
if (const std::optional<QList<T>> &array = optionalArray<T>(key))
|
||||
return *array;
|
||||
qCDebug(conversionLog) << QString("Expected array under %1 in:")
|
||||
.arg(QLatin1String(key.data())) << *this;
|
||||
qCDebug(conversionLog) << QString("Expected array under %1 in:").arg(key) << *this;
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::optional<QList<T>> JsonObject::optionalArray(const std::string_view key) const
|
||||
std::optional<QList<T>> JsonObject::optionalArray(const Key key) const
|
||||
{
|
||||
const QJsonValue &jsonValue = value(key);
|
||||
if (jsonValue.isUndefined())
|
||||
@@ -143,13 +144,13 @@ std::optional<QList<T>> JsonObject::optionalArray(const std::string_view key) co
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
LanguageClientArray<T> JsonObject::clientArray(const std::string_view key) const
|
||||
LanguageClientArray<T> JsonObject::clientArray(const Key key) const
|
||||
{
|
||||
return LanguageClientArray<T>(value(key));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::optional<LanguageClientArray<T>> JsonObject::optionalClientArray(const std::string_view key) const
|
||||
std::optional<LanguageClientArray<T>> JsonObject::optionalClientArray(const Key key) const
|
||||
{
|
||||
const QJsonValue &val = value(key);
|
||||
return !val.isUndefined() ? std::make_optional(LanguageClientArray<T>(value(key)))
|
||||
@@ -157,7 +158,7 @@ std::optional<LanguageClientArray<T>> JsonObject::optionalClientArray(const std:
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void JsonObject::insertArray(const std::string_view key, const QList<T> &array)
|
||||
void JsonObject::insertArray(const Key key, const QList<T> &array)
|
||||
{
|
||||
QJsonArray jsonArray;
|
||||
for (const T &item : array)
|
||||
@@ -166,7 +167,7 @@ void JsonObject::insertArray(const std::string_view key, const QList<T> &array)
|
||||
}
|
||||
|
||||
template<typename >
|
||||
void JsonObject::insertArray(const std::string_view key, const QList<JsonObject> &array)
|
||||
void JsonObject::insertArray(const Key key, const QList<JsonObject> &array)
|
||||
{
|
||||
QJsonArray jsonArray;
|
||||
for (const JsonObject &item : array)
|
||||
|
@@ -125,7 +125,7 @@ QHash<QString, DocumentFormattingProperty> FormattingOptions::properties() const
|
||||
for (const QString &key : keys()) {
|
||||
if (key == tabSizeKey || key == insertSpaceKey)
|
||||
continue;
|
||||
QJsonValue property = value(key.toStdString());
|
||||
QJsonValue property = value(key);
|
||||
if (property.isBool())
|
||||
ret[key] = property.toBool();
|
||||
if (property.isDouble())
|
||||
@@ -136,7 +136,7 @@ QHash<QString, DocumentFormattingProperty> FormattingOptions::properties() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FormattingOptions::setProperty(const std::string_view key, const DocumentFormattingProperty &property)
|
||||
void FormattingOptions::setProperty(const Key key, const DocumentFormattingProperty &property)
|
||||
{
|
||||
using namespace std;
|
||||
if (auto val = get_if<double>(&property))
|
||||
|
@@ -678,8 +678,8 @@ public:
|
||||
void clearTrimFinalNewlines() { remove(trimFinalNewlinesKey); }
|
||||
|
||||
QHash<QString, DocumentFormattingProperty> properties() const;
|
||||
void setProperty(const std::string_view key, const DocumentFormattingProperty &property);
|
||||
void removeProperty(const std::string_view &key) { remove(key); }
|
||||
void setProperty(const Key key, const DocumentFormattingProperty &property);
|
||||
void removeProperty(const Key &key) { remove(key); }
|
||||
|
||||
bool isValid() const override { return contains(insertSpaceKey) && contains(tabSizeKey); }
|
||||
};
|
||||
|
@@ -166,7 +166,7 @@ public:
|
||||
QString query() const { return typedValue<QString>(queryKey); }
|
||||
void setQuery(const QString &query) { insert(queryKey, query); }
|
||||
|
||||
void setLimit(int limit) { insert("limit", limit); } // clangd extension
|
||||
void setLimit(int limit) { insert(Key("limit"), limit); } // clangd extension
|
||||
|
||||
bool isValid() const override { return contains(queryKey); }
|
||||
};
|
||||
|
@@ -18,8 +18,8 @@ using namespace Utils;
|
||||
|
||||
namespace ClangCodeModel::Internal {
|
||||
|
||||
static constexpr char roleKey[] = "role";
|
||||
static constexpr char arcanaKey[] = "arcana";
|
||||
static constexpr LanguageServerProtocol::Key roleKey{"role"};
|
||||
static constexpr LanguageServerProtocol::Key arcanaKey{"arcana"};
|
||||
|
||||
QString ClangdAstNode::role() const { return typedValue<QString>(roleKey); }
|
||||
QString ClangdAstNode::kind() const { return typedValue<QString>(kindKey); }
|
||||
|
@@ -98,7 +98,7 @@ class SymbolDetails : public JsonObject
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
static constexpr char usrKey[] = "usr";
|
||||
static constexpr Key usrKey{"usr"};
|
||||
|
||||
// the unqualified name of the symbol
|
||||
QString name() const { return typedValue<QString>(nameKey); }
|
||||
@@ -229,15 +229,15 @@ class DiagnosticsCapabilities : public JsonObject
|
||||
{
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
void enableCategorySupport() { insert("categorySupport", true); }
|
||||
void enableCodeActionsInline() {insert("codeActionsInline", true);}
|
||||
void enableCategorySupport() { insert(Key{"categorySupport"}, true); }
|
||||
void enableCodeActionsInline() {insert(Key{"codeActionsInline"}, true);}
|
||||
};
|
||||
|
||||
class InactiveRegionsCapabilities : public JsonObject
|
||||
{
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
void enableInactiveRegionsSupport() { insert("inactiveRegions", true); }
|
||||
void enableInactiveRegionsSupport() { insert(Key{"inactiveRegions"}, true); }
|
||||
};
|
||||
|
||||
class ClangdTextDocumentClientCapabilities : public TextDocumentClientCapabilities
|
||||
@@ -246,9 +246,9 @@ public:
|
||||
using TextDocumentClientCapabilities::TextDocumentClientCapabilities;
|
||||
|
||||
void setPublishDiagnostics(const DiagnosticsCapabilities &caps)
|
||||
{ insert("publishDiagnostics", caps); }
|
||||
{ insert(Key{"publishDiagnostics"}, caps); }
|
||||
void setInactiveRegionsCapabilities(const InactiveRegionsCapabilities &caps)
|
||||
{ insert("inactiveRegionsCapabilities", caps); }
|
||||
{ insert(Key{"inactiveRegionsCapabilities"}, caps); }
|
||||
};
|
||||
|
||||
static qint64 getRevision(const TextDocument *doc)
|
||||
@@ -1594,7 +1594,7 @@ void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
|
||||
|
||||
std::optional<QList<CodeAction> > ClangdDiagnostic::codeActions() const
|
||||
{
|
||||
auto actions = optionalArray<LanguageServerProtocol::CodeAction>("codeActions");
|
||||
auto actions = optionalArray<LanguageServerProtocol::CodeAction>(Key{"codeActions"});
|
||||
if (!actions)
|
||||
return actions;
|
||||
static const QStringList badCodeActions{
|
||||
@@ -1611,7 +1611,7 @@ std::optional<QList<CodeAction> > ClangdDiagnostic::codeActions() const
|
||||
|
||||
QString ClangdDiagnostic::category() const
|
||||
{
|
||||
return typedValue<QString>("category");
|
||||
return typedValue<QString>(Key{"category"});
|
||||
}
|
||||
|
||||
MessageId ClangdClient::Private::getAndHandleAst(const TextDocOrFile &doc,
|
||||
|
@@ -623,7 +623,7 @@ IAssistProposal *ClangdFunctionHintProcessor::perform()
|
||||
ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &object)
|
||||
: TextDocumentClientCapabilities::CompletionCapabilities(object)
|
||||
{
|
||||
insert("editsNearCursor", true); // For dot-to-arrow correction.
|
||||
insert(Key{"editsNearCursor"}, true); // For dot-to-arrow correction.
|
||||
if (std::optional<CompletionItemCapbilities> completionItemCaps = completionItem()) {
|
||||
completionItemCaps->setSnippetSupport(false);
|
||||
setCompletionItem(*completionItemCaps);
|
||||
|
@@ -46,8 +46,8 @@ public:
|
||||
return components;
|
||||
}
|
||||
|
||||
static constexpr char totalKey[] = "_total";
|
||||
static constexpr char selfKey[] = "_self";
|
||||
static constexpr Key totalKey{"_total"};
|
||||
static constexpr Key selfKey{"_self"};
|
||||
};
|
||||
|
||||
|
||||
|
@@ -968,7 +968,9 @@ public:
|
||||
using JsonObject::JsonObject;
|
||||
|
||||
DocumentUri uri() const { return TextDocumentIdentifier(value("textDocument")).uri(); }
|
||||
QList<Range> inactiveRegions() const { return array<Range>("regions"); }
|
||||
QList<Range> inactiveRegions() const {
|
||||
return array<Range>(LanguageServerProtocol::Key{"regions"});
|
||||
}
|
||||
};
|
||||
|
||||
class InactiveRegionsNotification : public Notification<InactiveRegionsParams>
|
||||
|
@@ -239,7 +239,7 @@ public:
|
||||
void enableCodecoverageSupport()
|
||||
{
|
||||
JsonObject coverageSupport(QJsonObject{{"codeCoverageSupport", true}});
|
||||
insert("publishDiagnostics", coverageSupport);
|
||||
insert(Key("publishDiagnostics"), coverageSupport);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -10,8 +10,8 @@ namespace Copilot {
|
||||
|
||||
class CheckStatusParams : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char optionsKey[] = "options";
|
||||
static constexpr char localChecksOnlyKey[] = "options";
|
||||
static constexpr Key optionsKey{"options"};
|
||||
static constexpr Key localChecksOnlyKey{"options"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -30,8 +30,8 @@ public:
|
||||
|
||||
class CheckStatusResponse : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char userKey[] = "user";
|
||||
static constexpr char statusKey[] = "status";
|
||||
static constexpr Key userKey{"user"};
|
||||
static constexpr Key statusKey{"status"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
|
@@ -11,8 +11,8 @@ namespace Copilot {
|
||||
|
||||
class Completion : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char displayTextKey[] = "displayText";
|
||||
static constexpr char uuidKey[] = "uuid";
|
||||
static constexpr Key displayTextKey{"displayText"};
|
||||
static constexpr Key uuidKey{"uuid"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
class GetCompletionParams : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
public:
|
||||
static constexpr char docKey[] = "doc";
|
||||
static constexpr Key docKey{"doc"};
|
||||
|
||||
GetCompletionParams(const LanguageServerProtocol::TextDocumentIdentifier &document,
|
||||
int version,
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
class GetCompletionResponse : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char completionKey[] = "completions";
|
||||
static constexpr Key completionKey{"completions"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
: Request(methodName, params)
|
||||
{}
|
||||
using Request::Request;
|
||||
constexpr static const char methodName[] = "getCompletionsCycling";
|
||||
constexpr static const LanguageServerProtocol::Key methodName{"getCompletionsCycling"};
|
||||
};
|
||||
|
||||
} // namespace Copilot
|
||||
|
@@ -10,10 +10,12 @@
|
||||
|
||||
namespace Copilot {
|
||||
|
||||
using Key = LanguageServerProtocol::Key;
|
||||
|
||||
class EditorPluginInfo : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char version[] = "version";
|
||||
static constexpr char name[] = "name";
|
||||
static constexpr Key version{"version"};
|
||||
static constexpr Key name{"name"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -30,8 +32,8 @@ public:
|
||||
|
||||
class EditorInfo : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char version[] = "version";
|
||||
static constexpr char name[] = "name";
|
||||
static constexpr Key version{"version"};
|
||||
static constexpr Key name{"name"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -48,11 +50,11 @@ public:
|
||||
|
||||
class NetworkProxy : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char host[] = "host";
|
||||
static constexpr char port[] = "port";
|
||||
static constexpr char user[] = "username";
|
||||
static constexpr char password[] = "password";
|
||||
static constexpr char rejectUnauthorized[] = "rejectUnauthorized";
|
||||
static constexpr Key host{"host"};
|
||||
static constexpr Key port{"port"};
|
||||
static constexpr Key user{"username"};
|
||||
static constexpr Key password{"password"};
|
||||
static constexpr Key rejectUnauthorized{"rejectUnauthorized"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -70,7 +72,7 @@ public:
|
||||
setRejectUnauthorized(rejectUnauthorized);
|
||||
}
|
||||
|
||||
void insertIfNotEmpty(const std::string_view key, const QString &value)
|
||||
void insertIfNotEmpty(const Key key, const QString &value)
|
||||
{
|
||||
if (!value.isEmpty())
|
||||
insert(key, value);
|
||||
@@ -85,9 +87,9 @@ public:
|
||||
|
||||
class SetEditorInfoParams : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char editorInfo[] = "editorInfo";
|
||||
static constexpr char editorPluginInfo[] = "editorPluginInfo";
|
||||
static constexpr char networkProxy[] = "networkProxy";
|
||||
static constexpr Key editorInfo{"editorInfo"};
|
||||
static constexpr Key editorPluginInfo{"editorPluginInfo"};
|
||||
static constexpr Key networkProxy{"networkProxy"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -120,7 +122,7 @@ public:
|
||||
: Request(methodName, params)
|
||||
{}
|
||||
using Request::Request;
|
||||
constexpr static const char methodName[] = "setEditorInfo";
|
||||
constexpr static const Key methodName{"setEditorInfo"};
|
||||
};
|
||||
|
||||
} // namespace Copilot
|
||||
|
@@ -12,7 +12,7 @@ namespace Copilot {
|
||||
|
||||
class SignInConfirmParams : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char userCodeKey[] = "userCode";
|
||||
static constexpr LanguageServerProtocol::Key userCodeKey{"userCode"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
: Request(methodName, {userCode})
|
||||
{}
|
||||
using Request::Request;
|
||||
constexpr static const char methodName[] = "signInConfirm";
|
||||
constexpr static const LanguageServerProtocol::Key methodName{"signInConfirm"};
|
||||
};
|
||||
|
||||
} // namespace Copilot
|
||||
|
@@ -14,11 +14,12 @@
|
||||
namespace Copilot {
|
||||
|
||||
using SignInInitiateParams = LanguageServerProtocol::JsonObject;
|
||||
using Key = LanguageServerProtocol::Key;
|
||||
|
||||
class SignInInitiateResponse : public LanguageServerProtocol::JsonObject
|
||||
{
|
||||
static constexpr char verificationUriKey[] = "verificationUri";
|
||||
static constexpr char userCodeKey[] = "userCode";
|
||||
static constexpr Key verificationUriKey{"verificationUri"};
|
||||
static constexpr Key userCodeKey{"userCode"};
|
||||
|
||||
public:
|
||||
using JsonObject::JsonObject;
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
: Request(methodName, {})
|
||||
{}
|
||||
using Request::Request;
|
||||
constexpr static const char methodName[] = "signInInitiate";
|
||||
constexpr static const Key methodName{"signInInitiate"};
|
||||
};
|
||||
|
||||
} // namespace Copilot
|
||||
|
Reference in New Issue
Block a user