Skip to content

Commit

Permalink
Revert "Merge branch 'develop' into rc/0.2.0"
Browse files Browse the repository at this point in the history
This reverts commit b1b163e, reversing
changes made to 06c1d05.
  • Loading branch information
marcuscastelo committed Jan 4, 2023
1 parent 6bca3b3 commit e53171b
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 1,946 deletions.
134 changes: 0 additions & 134 deletions .github/workflows/all-envs.yml

This file was deleted.

111 changes: 0 additions & 111 deletions .github/workflows/fast.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Node.js CI

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [10.x, 12.x, 14.x, 15.x]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run pretest
- uses: GabrielBB/xvfb-action@v1.0
with:
run: npm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ dist
node_modules
.vscode-test/
*.vsix
yarn*
package-lock.json

old/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
]
},
"activationEvents": [
"onLanguage:anime-list"
"onLanguage:anime-list"
],
"scripts": {
"vscode:prepublish": "yarn run compile",
Expand Down
4 changes: 0 additions & 4 deletions src/cache/anime/show-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ export default class ShowStorage extends Registry<Show> {
return Array.from(this.showDict.keys());
}

public iterShows() {
return this.showDict.values();
}

public listFriends() {
return [...this.friendList];
}
Expand Down
2 changes: 1 addition & 1 deletion src/cache/anime/shows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Show {

this.info = {
title,
lastMentionedLine: lastMentionedLine ?? declarationLine,
lastMentionedLine: lastMentionedLine ?? -1,
watchEntries: watchEntries ?? [],
firstMentionedLine: declarationLine,
tags: tags ?? [],
Expand Down
2 changes: 0 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { formatFriend } from './commands/format-friend';
import ShowDefinitionProvider from './lang/anime-definition-provider';
import { TagRegistry } from './core/registry/tag-registry';
import { registerDefaultTags } from './core/tag';
import ShowSymbolProvider from './lang/anime-symbol-provider';

type ExtensionActivationState = { activated: true, context: ExtensionContext } | { activated: false };

Expand Down Expand Up @@ -100,7 +99,6 @@ export class MarucsAnime {
AnimeCompletionItemProvider.register(context),
ShowLensProvider.register(context),
ShowDefinitionProvider.register(context),
ShowSymbolProvider.register(context),
);
}
}
19 changes: 5 additions & 14 deletions src/lang/anime-completion-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as vscode from "vscode";
import ShowStorage from "../cache/anime/show-storage";
import { LANGUAGE_ID } from "../constants";
import { MarucsAnime } from "../extension";
import { Show } from "../cache/anime/shows";

enum CompletionType {
ShowTitle = 'ShowTitle',
Expand Down Expand Up @@ -67,10 +66,9 @@ export default class ShowCompletionItemProvider implements CompletionItemProvide
}

private getCompletionOptionsFromStorage(storage: ShowStorage, completionType: CompletionType): string[] {
const byLastMentionedLine = (show1: Show, show2: Show) => show2.info.lastMentionedLine - show1.info.lastMentionedLine;
switch (completionType) {
case CompletionType.Friend: return storage.listFriends();
case CompletionType.ShowTitle: return [...storage.iterShows()].sort(byLastMentionedLine).map(show => show.info.title);
case CompletionType.ShowTitle: return storage.listShows();
case CompletionType.Tag: return MarucsAnime.INSTANCE.tagRegistry.listKeys();
default:
console.error('Not Implemented completion: ', completionType.toString());
Expand Down Expand Up @@ -131,24 +129,17 @@ export default class ShowCompletionItemProvider implements CompletionItemProvide
[CompletionType.NoCompletion]: undefined,
};

const createCompletionItem = (option: string, index: number): CompletionItem => {
const createCompletionItem = (option: string): CompletionItem => {
const commitCharacters = commitCharactersPerType[completionType];
const textToInsert = option + postfixesPerType[completionType];

const zeros = Math.ceil(Math.log10(options.length+1));
const indexAlphaOrdered =`${(index+1)}`.padStart(zeros, '0');
const sortIndex = `${indexAlphaOrdered}/${options.length}`;

const item = <CompletionItem>{
// label: `${sortIndex} - ${option}`,
label: `${option}`,
const item = {
label: option,
kind: getCompletionKind(),
insertText: textToInsert,
keepWhitespace: true,
range: new Range(position.translate(0, -alreadyTypedText.length), position),
commitCharacters: commitCharacters,
command: commandPerType[completionType],
sortText: sortIndex,
command: commandPerType[completionType]
};
return item;
};
Expand Down
Loading

0 comments on commit e53171b

Please sign in to comment.