From 7f3c3c97dfa1db52444dc971febe536c35dd08aa Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Mon, 11 Sep 2023 06:54:07 +0900 Subject: [PATCH] - Rename to completionlib - cosmetic edits --- .../completionupdaterlib/citationupdater.ts | 4 +- .../completionupdaterlib/commandupdater.ts | 2 +- .../commandupdaterlib/commandfinder.ts | 10 ++-- .../environmentupdater.ts | 6 +-- .../completionupdaterlib/glossaryupdater.ts | 6 +-- .../labeldefinitionupdater.ts | 2 +- src/components/manager.ts | 19 ++++---- src/components/mathpreview.ts | 22 ++++----- .../mathpreviewlib/hoverpreviewonref.ts | 8 ++-- .../mathpreviewlib/texmathenvfinder.ts | 2 +- src/providers/atsuggestionlib/atsuggestion.ts | 4 +- src/providers/bibtexcompletion.ts | 2 +- src/providers/completion.ts | 47 +++++++++++-------- .../bracketreplacer.ts | 0 .../{completer => completionlib}/citation.ts | 0 .../{completer => completionlib}/command.ts | 0 .../commandadder.ts | 0 .../commandlib/commandlib.ts | 0 .../commandremover.ts | 0 .../commandreplacer.ts | 0 .../completionkind.ts | 0 .../documentclass.ts | 0 .../{completer => completionlib}/envcloser.ts | 0 .../environment.ts | 0 .../{completer => completionlib}/envrename.ts | 0 .../{completer => completionlib}/glossary.ts | 0 .../{completer => completionlib}/input.ts | 0 .../{completer => completionlib}/interface.ts | 0 .../labeldefinition.ts | 0 .../{completer => completionlib}/package.ts | 0 .../utils/position.ts | 0 .../utils/sortkey.ts | 0 .../commandlib/commandfinder.test.ts | 2 +- 33 files changed, 73 insertions(+), 63 deletions(-) rename src/providers/{completer => completionlib}/bracketreplacer.ts (100%) rename src/providers/{completer => completionlib}/citation.ts (100%) rename src/providers/{completer => completionlib}/command.ts (100%) rename src/providers/{completer => completionlib}/commandadder.ts (100%) rename src/providers/{completer => completionlib}/commandlib/commandlib.ts (100%) rename src/providers/{completer => completionlib}/commandremover.ts (100%) rename src/providers/{completer => completionlib}/commandreplacer.ts (100%) rename src/providers/{completer => completionlib}/completionkind.ts (100%) rename src/providers/{completer => completionlib}/documentclass.ts (100%) rename src/providers/{completer => completionlib}/envcloser.ts (100%) rename src/providers/{completer => completionlib}/environment.ts (100%) rename src/providers/{completer => completionlib}/envrename.ts (100%) rename src/providers/{completer => completionlib}/glossary.ts (100%) rename src/providers/{completer => completionlib}/input.ts (100%) rename src/providers/{completer => completionlib}/interface.ts (100%) rename src/providers/{completer => completionlib}/labeldefinition.ts (100%) rename src/providers/{completer => completionlib}/package.ts (100%) rename src/providers/{completer => completionlib}/utils/position.ts (100%) rename src/providers/{completer => completionlib}/utils/sortkey.ts (100%) diff --git a/src/components/completionupdaterlib/citationupdater.ts b/src/components/completionupdaterlib/citationupdater.ts index 9e98cddfc..a561e1b70 100644 --- a/src/components/completionupdaterlib/citationupdater.ts +++ b/src/components/completionupdaterlib/citationupdater.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode' -import {CiteSuggestion, Fields} from '../../providers/completer/citation' +import { CiteSuggestion, Fields } from '../../providers/completionlib/citation' import type { Logger } from '../logger' import type { Manager } from '../manager' -import { ReferenceKind } from '../../providers/completer/completionkind' +import { ReferenceKind } from '../../providers/completionlib/completionkind' export class CitationUpdater { diff --git a/src/components/completionupdaterlib/commandupdater.ts b/src/components/completionupdaterlib/commandupdater.ts index 673995687..e66e1b520 100644 --- a/src/components/completionupdaterlib/commandupdater.ts +++ b/src/components/completionupdaterlib/commandupdater.ts @@ -1,6 +1,6 @@ import {latexParser} from 'latex-utensils' -import { CommandNameDuplicationDetector } from '../../providers/completer/commandlib/commandlib' +import { CommandNameDuplicationDetector } from '../../providers/completionlib/commandlib/commandlib' import { CommandFinder } from './commandupdaterlib/commandfinder' import type { Completer } from '../../providers/completion' import type { Manager } from '../manager' diff --git a/src/components/completionupdaterlib/commandupdaterlib/commandfinder.ts b/src/components/completionupdaterlib/commandupdaterlib/commandfinder.ts index b0bb3c5f4..1e48d3f40 100644 --- a/src/components/completionupdaterlib/commandupdaterlib/commandfinder.ts +++ b/src/components/completionupdaterlib/commandupdaterlib/commandfinder.ts @@ -1,10 +1,10 @@ import * as vscode from 'vscode' import { latexParser } from 'latex-utensils' -import { CmdEnvSuggestion } from '../../../providers/completer/command' -import { CommandNameDuplicationDetector, CommandSignatureDuplicationDetector, isTriggerSuggestNeeded } from '../../../providers/completer/commandlib/commandlib' -import { Completer } from '../../../providers/completion' -import { Manager } from '../../manager' -import { CommandKind } from '../../../providers/completer/completionkind' +import { CmdEnvSuggestion } from '../../../providers/completionlib/command' +import { CommandNameDuplicationDetector, CommandSignatureDuplicationDetector, isTriggerSuggestNeeded } from '../../../providers/completionlib/commandlib/commandlib' +import type { Completer } from '../../../providers/completion' +import type { Manager } from '../../manager' +import { CommandKind } from '../../../providers/completionlib/completionkind' export class CommandFinder { diff --git a/src/components/completionupdaterlib/environmentupdater.ts b/src/components/completionupdaterlib/environmentupdater.ts index e7676e1ad..b899d910e 100644 --- a/src/components/completionupdaterlib/environmentupdater.ts +++ b/src/components/completionupdaterlib/environmentupdater.ts @@ -1,7 +1,7 @@ -import {latexParser} from 'latex-utensils' -import {CmdEnvSuggestion} from '../../providers/completer/command' +import { latexParser } from 'latex-utensils' +import { CmdEnvSuggestion } from '../../providers/completionlib/command' import type { Manager } from '../manager' -import { EnvKind } from '../../providers/completer/completionkind' +import { EnvKind } from '../../providers/completionlib/completionkind' export class EnvironmentUpdater { diff --git a/src/components/completionupdaterlib/glossaryupdater.ts b/src/components/completionupdaterlib/glossaryupdater.ts index 110a0a706..f60f967fe 100644 --- a/src/components/completionupdaterlib/glossaryupdater.ts +++ b/src/components/completionupdaterlib/glossaryupdater.ts @@ -1,9 +1,9 @@ -import {latexParser} from 'latex-utensils' +import { latexParser } from 'latex-utensils' -import {GlossarySuggestion, GlossaryType} from '../../providers/completer/glossary' +import { GlossarySuggestion, GlossaryType } from '../../providers/completionlib/glossary' import { toVscodePosition } from '../../utils/utensils' import { Manager } from '../manager' -import { ReferenceKind } from '../../providers/completer/completionkind' +import { ReferenceKind } from '../../providers/completionlib/completionkind' interface GlossaryEntry { readonly label: string | undefined, diff --git a/src/components/completionupdaterlib/labeldefinitionupdater.ts b/src/components/completionupdaterlib/labeldefinitionupdater.ts index 26ec60adc..3e0bdd106 100644 --- a/src/components/completionupdaterlib/labeldefinitionupdater.ts +++ b/src/components/completionupdaterlib/labeldefinitionupdater.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode' import {latexParser} from 'latex-utensils' import {isNewCommand} from '../../utils/utils' -import { LabelDefinitionElement } from '../../providers/completer/labeldefinition' +import type { LabelDefinitionElement } from '../../providers/completionlib/labeldefinition' import { toVscodeRange } from '../../utils/utensils' import type { Manager } from '../manager' diff --git a/src/components/manager.ts b/src/components/manager.ts index d35308011..24a8da2db 100644 --- a/src/components/manager.ts +++ b/src/components/manager.ts @@ -1,19 +1,20 @@ import * as vscode from 'vscode' import * as path from 'path' import * as utils from '../utils/utils' -import {InputFileRegExp} from '../utils/inputfilepath' + +import { InputFileRegExp } from '../utils/inputfilepath' import { isCacheLatest } from '../utils/utils' -import type {CmdEnvSuggestion} from '../providers/completer/command' -import type {CiteSuggestion} from '../providers/completer/citation' -import type {GlossarySuggestion} from '../providers/completer/glossary' +import type { CmdEnvSuggestion } from '../providers/completionlib/command' +import type { CiteSuggestion } from '../providers/completionlib/citation' +import type { GlossarySuggestion } from '../providers/completionlib/glossary' -import {PdfWatcher} from './managerlib/pdfwatcher' -import {BibWatcher} from './managerlib/bibwatcher' -import {FinderUtils} from './managerlib/finderutils' -import {PathUtils} from './managerlib/pathutils' +import { PdfWatcher } from './managerlib/pdfwatcher' +import { BibWatcher } from './managerlib/bibwatcher' +import { FinderUtils } from './managerlib/finderutils' +import { PathUtils } from './managerlib/pathutils' -import { LabelDefinitionElement } from '../providers/completer/labeldefinition' +import { LabelDefinitionElement } from '../providers/completionlib/labeldefinition' import { existsPath, isLocalLatexDocument, isVirtualUri, readFileGracefully, readFilePath, statPath } from '../lib/lwfs/lwfs' import { ExternalPromise } from '../utils/externalpromise' import { MutexWithSizedQueue } from '../utils/mutexwithsizedqueue' diff --git a/src/components/mathpreview.ts b/src/components/mathpreview.ts index 498b65d06..72772adad 100644 --- a/src/components/mathpreview.ts +++ b/src/components/mathpreview.ts @@ -1,21 +1,21 @@ import * as vscode from 'vscode' -import {MathJaxPool} from './mathpreviewlib/mathjaxpool' +import { MathJaxPool } from './mathpreviewlib/mathjaxpool' import * as utils from '../utils/svg' -import type {LabelDefinitionEntry} from '../providers/completer/labeldefinition' -import {getCurrentThemeLightness} from '../utils/theme' - -import {CursorRenderer} from './mathpreviewlib/cursorrenderer' -import {type ITextDocumentLike, TextDocumentLike} from './mathpreviewlib/textdocumentlike' -import {NewCommandFinder} from './mathpreviewlib/newcommandfinder' -import {TexMathEnv, TeXMathEnvFinder} from './mathpreviewlib/texmathenvfinder' -import {HoverPreviewOnRefProvider} from './mathpreviewlib/hoverpreviewonref' -import {MathPreviewUtils} from './mathpreviewlib/mathpreviewutils' +import type { LabelDefinitionEntry } from '../providers/completionlib/labeldefinition' +import { getCurrentThemeLightness } from '../utils/theme' + +import { CursorRenderer } from './mathpreviewlib/cursorrenderer' +import { type ITextDocumentLike, TextDocumentLike } from './mathpreviewlib/textdocumentlike' +import { NewCommandFinder } from './mathpreviewlib/newcommandfinder' +import { TexMathEnv, TeXMathEnvFinder } from './mathpreviewlib/texmathenvfinder' +import { HoverPreviewOnRefProvider } from './mathpreviewlib/hoverpreviewonref' +import { MathPreviewUtils } from './mathpreviewlib/mathpreviewutils' import { Logger } from './logger' import { Manager } from './manager' import { UtensilsParser } from './utensilsparser' -export type {TexMathEnv} from './mathpreviewlib/texmathenvfinder' +export type { TexMathEnv } from './mathpreviewlib/texmathenvfinder' export class MathPreview { diff --git a/src/components/mathpreviewlib/hoverpreviewonref.ts b/src/components/mathpreviewlib/hoverpreviewonref.ts index c53de3a76..c3dd4a1ce 100644 --- a/src/components/mathpreviewlib/hoverpreviewonref.ts +++ b/src/components/mathpreviewlib/hoverpreviewonref.ts @@ -1,9 +1,9 @@ import * as vscode from 'vscode' import * as utils from '../../utils/svg' -import type {MathJaxPool} from './mathjaxpool' -import type {LabelDefinitionEntry} from '../../providers/completer/labeldefinition' -import type {TexMathEnv} from './texmathenvfinder' -import type {MathPreviewUtils} from './mathpreviewutils' +import type { MathJaxPool } from './mathjaxpool' +import type { LabelDefinitionEntry } from '../../providers/completionlib/labeldefinition' +import type { TexMathEnv } from './texmathenvfinder' +import type { MathPreviewUtils } from './mathpreviewutils' import type { Logger } from '../logger' diff --git a/src/components/mathpreviewlib/texmathenvfinder.ts b/src/components/mathpreviewlib/texmathenvfinder.ts index 8abbe54af..6dae90ce6 100644 --- a/src/components/mathpreviewlib/texmathenvfinder.ts +++ b/src/components/mathpreviewlib/texmathenvfinder.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode' import * as utils from '../../utils/utils' import { type ITextDocumentLike, TextDocumentLike } from './textdocumentlike' -import type { LabelDefinitionEntry } from '../../providers/completer/labeldefinition' +import type { LabelDefinitionEntry } from '../../providers/completionlib/labeldefinition' export type TexMathEnv = { readonly texString: string, diff --git a/src/providers/atsuggestionlib/atsuggestion.ts b/src/providers/atsuggestionlib/atsuggestion.ts index 4ea9ce97f..619be4100 100644 --- a/src/providers/atsuggestionlib/atsuggestion.ts +++ b/src/providers/atsuggestionlib/atsuggestion.ts @@ -1,9 +1,9 @@ import * as vscode from 'vscode' -import type { IProvider } from '../completer/interface' +import type { IProvider } from '../completionlib/interface' import { escapeRegExp } from '../../utils/utils' import { readFilePath } from '../../lib/lwfs/lwfs' -import { CommandKind } from '../completer/completionkind' +import { CommandKind } from '../completionlib/completionkind' export interface AtSuggestionItemEntry { diff --git a/src/providers/bibtexcompletion.ts b/src/providers/bibtexcompletion.ts index 15eaceb08..7fa66a082 100644 --- a/src/providers/bibtexcompletion.ts +++ b/src/providers/bibtexcompletion.ts @@ -5,7 +5,7 @@ import { readFilePath } from '../lib/lwfs/lwfs' import { hasBibtexId } from '../utils/hastexid' import type { Logger } from '../components/logger' import type { Manager } from '../components/manager' -import { BibtexSnippetKind } from './completer/completionkind' +import { BibtexSnippetKind } from './completionlib/completionkind' type DataBibtexJsonType = typeof import('../../data/bibtex-entries.json') diff --git a/src/providers/completion.ts b/src/providers/completion.ts index 1ab636521..07ffb108a 100644 --- a/src/providers/completion.ts +++ b/src/providers/completion.ts @@ -1,28 +1,28 @@ import * as vscode from 'vscode' import { latexParser } from 'latex-utensils' -import type {IContexAwareProvider, IProvider} from './completer/interface' -import {Citation} from './completer/citation' -import {DocumentClass} from './completer/documentclass' -import {Command} from './completer/command' -import type {CmdItemEntry} from './completer/command' -import {Environment} from './completer/environment' -import type {EnvItemEntry} from './completer/environment' -import {LabelDefinition} from './completer/labeldefinition' -import {Package} from './completer/package' -import {Input, Import, SubImport} from './completer/input' -import {Glossary} from './completer/glossary' +import type { IContexAwareProvider, IProvider } from './completionlib/interface' +import { Citation } from './completionlib/citation' +import { DocumentClass } from './completionlib/documentclass' +import { Command } from './completionlib/command' +import type { CmdItemEntry } from './completionlib/command' +import { Environment } from './completionlib/environment' +import type { EnvItemEntry } from './completionlib/environment' +import { LabelDefinition } from './completionlib/labeldefinition' +import { Package } from './completionlib/package' +import { Input, Import, SubImport } from './completionlib/input' +import { Glossary } from './completionlib/glossary' import { readFilePath } from '../lib/lwfs/lwfs' -import { BracketReplacer } from './completer/bracketreplacer' -import { CommandRemover } from './completer/commandremover' -import { CommandReplacer } from './completer/commandreplacer' -import { EnvCloser } from './completer/envcloser' -import { EnvRename } from './completer/envrename' -import { CommandAdder } from './completer/commandadder' +import { BracketReplacer } from './completionlib/bracketreplacer' +import { CommandRemover } from './completionlib/commandremover' +import { CommandReplacer } from './completionlib/commandreplacer' +import { EnvCloser } from './completionlib/envcloser' +import { EnvRename } from './completionlib/envrename' +import { CommandAdder } from './completionlib/commandadder' import type { LatexAstManager } from '../components/astmanager' import type { GraphicsPreview } from '../components/graphicspreview' import type { MathPreview } from '../components/mathpreview' -import { FileKind, ReferenceKind } from './completer/completionkind' +import { FileKind, ReferenceKind } from './completionlib/completionkind' type DataEnvsJsonType = typeof import('../../data/environments.json') @@ -208,7 +208,16 @@ export class Completer implements vscode.CompletionItemProvider { } } - private async completion(type: CompletionType, line: string, args: {document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, context: vscode.CompletionContext}) { + private async completion( + type: CompletionType, + line: string, + args: { + document: vscode.TextDocument, + position: vscode.Position, + token: vscode.CancellationToken, + context: vscode.CompletionContext + } + ) { let reg: RegExp | undefined let provider: IProvider | undefined switch (type) { diff --git a/src/providers/completer/bracketreplacer.ts b/src/providers/completionlib/bracketreplacer.ts similarity index 100% rename from src/providers/completer/bracketreplacer.ts rename to src/providers/completionlib/bracketreplacer.ts diff --git a/src/providers/completer/citation.ts b/src/providers/completionlib/citation.ts similarity index 100% rename from src/providers/completer/citation.ts rename to src/providers/completionlib/citation.ts diff --git a/src/providers/completer/command.ts b/src/providers/completionlib/command.ts similarity index 100% rename from src/providers/completer/command.ts rename to src/providers/completionlib/command.ts diff --git a/src/providers/completer/commandadder.ts b/src/providers/completionlib/commandadder.ts similarity index 100% rename from src/providers/completer/commandadder.ts rename to src/providers/completionlib/commandadder.ts diff --git a/src/providers/completer/commandlib/commandlib.ts b/src/providers/completionlib/commandlib/commandlib.ts similarity index 100% rename from src/providers/completer/commandlib/commandlib.ts rename to src/providers/completionlib/commandlib/commandlib.ts diff --git a/src/providers/completer/commandremover.ts b/src/providers/completionlib/commandremover.ts similarity index 100% rename from src/providers/completer/commandremover.ts rename to src/providers/completionlib/commandremover.ts diff --git a/src/providers/completer/commandreplacer.ts b/src/providers/completionlib/commandreplacer.ts similarity index 100% rename from src/providers/completer/commandreplacer.ts rename to src/providers/completionlib/commandreplacer.ts diff --git a/src/providers/completer/completionkind.ts b/src/providers/completionlib/completionkind.ts similarity index 100% rename from src/providers/completer/completionkind.ts rename to src/providers/completionlib/completionkind.ts diff --git a/src/providers/completer/documentclass.ts b/src/providers/completionlib/documentclass.ts similarity index 100% rename from src/providers/completer/documentclass.ts rename to src/providers/completionlib/documentclass.ts diff --git a/src/providers/completer/envcloser.ts b/src/providers/completionlib/envcloser.ts similarity index 100% rename from src/providers/completer/envcloser.ts rename to src/providers/completionlib/envcloser.ts diff --git a/src/providers/completer/environment.ts b/src/providers/completionlib/environment.ts similarity index 100% rename from src/providers/completer/environment.ts rename to src/providers/completionlib/environment.ts diff --git a/src/providers/completer/envrename.ts b/src/providers/completionlib/envrename.ts similarity index 100% rename from src/providers/completer/envrename.ts rename to src/providers/completionlib/envrename.ts diff --git a/src/providers/completer/glossary.ts b/src/providers/completionlib/glossary.ts similarity index 100% rename from src/providers/completer/glossary.ts rename to src/providers/completionlib/glossary.ts diff --git a/src/providers/completer/input.ts b/src/providers/completionlib/input.ts similarity index 100% rename from src/providers/completer/input.ts rename to src/providers/completionlib/input.ts diff --git a/src/providers/completer/interface.ts b/src/providers/completionlib/interface.ts similarity index 100% rename from src/providers/completer/interface.ts rename to src/providers/completionlib/interface.ts diff --git a/src/providers/completer/labeldefinition.ts b/src/providers/completionlib/labeldefinition.ts similarity index 100% rename from src/providers/completer/labeldefinition.ts rename to src/providers/completionlib/labeldefinition.ts diff --git a/src/providers/completer/package.ts b/src/providers/completionlib/package.ts similarity index 100% rename from src/providers/completer/package.ts rename to src/providers/completionlib/package.ts diff --git a/src/providers/completer/utils/position.ts b/src/providers/completionlib/utils/position.ts similarity index 100% rename from src/providers/completer/utils/position.ts rename to src/providers/completionlib/utils/position.ts diff --git a/src/providers/completer/utils/sortkey.ts b/src/providers/completionlib/utils/sortkey.ts similarity index 100% rename from src/providers/completer/utils/sortkey.ts rename to src/providers/completionlib/utils/sortkey.ts diff --git a/test/unittests/providers/completer/commandlib/commandfinder.test.ts b/test/unittests/providers/completer/commandlib/commandfinder.test.ts index 452a599ff..390f6fa42 100644 --- a/test/unittests/providers/completer/commandlib/commandfinder.test.ts +++ b/test/unittests/providers/completer/commandlib/commandfinder.test.ts @@ -1,5 +1,5 @@ import {runUnitTestWithFixture} from '../../../../utils/ciutils' -import {isTriggerSuggestNeeded} from '../../../../../src/providers/completer/commandlib/commandlib' +import {isTriggerSuggestNeeded} from '../../../../../src/providers/completionlib/commandlib/commandlib' import assert from 'assert'