fix: changing files

This commit is contained in:
iCrawl 2021-04-14 14:56:15 +02:00
parent 6c1bcb6524
commit 7cefeb2af8
No known key found for this signature in database
GPG key ID: 1AB888B16355FBB2
4 changed files with 12 additions and 21 deletions

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "discord-vscode",
"version": "5.5.0",
"version": "5.6.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,7 +1,7 @@
{
"name": "discord-vscode",
"displayName": "Discord Presence",
"version": "5.5.0",
"version": "5.6.0",
"description": "Update your discord status with a rich presence.",
"private": true,
"author": {

View file

@ -1,21 +1,11 @@
const { Client } = require('discord-rpc'); // eslint-disable-line
import {
commands,
ExtensionContext,
StatusBarAlignment,
StatusBarItem,
window,
workspace,
extensions,
debug,
} from 'vscode';
import { commands, ExtensionContext, StatusBarAlignment, StatusBarItem, window, workspace, debug } from 'vscode';
import throttle from 'lodash-es/throttle';
import { activity } from './activity';
import { CLIENT_ID, CONFIG_KEYS } from './constants';
import { GitExtension } from './git';
import { log, LogLevel } from './logger';
import { getConfig } from './util';
import { getConfig, getGit } from './util';
const statusBarIcon: StatusBarItem = window.createStatusBarItem(StatusBarAlignment.Left);
statusBarIcon.text = '$(pulse) Connecting to Discord...';
@ -173,12 +163,7 @@ export async function activate(context: ExtensionContext) {
}
});
try {
const gitExtension = extensions.getExtension<GitExtension>('vscode.git');
if (!gitExtension?.isActive) {
await gitExtension?.activate();
}
} catch {}
await getGit();
}
export async function deactivate() {

View file

@ -5,6 +5,8 @@ import { KNOWN_EXTENSIONS, KNOWN_LANGUAGES } from './constants';
import { API, GitExtension } from './git';
import { log, LogLevel } from './logger';
let git: API | null | undefined;
type WorkspaceExtensionConfiguration = WorkspaceConfiguration & {
enabled: boolean;
detailsIdling: string;
@ -63,7 +65,10 @@ export function resolveFileIcon(document: TextDocument) {
}
export async function getGit() {
let git: API | undefined;
if (git || git === null) {
return git;
}
try {
log(LogLevel.Debug, 'Loading git extension');
const gitExtension = extensions.getExtension<GitExtension>('vscode.git');
@ -73,6 +78,7 @@ export async function getGit() {
}
git = gitExtension?.exports.getAPI(1);
} catch (error) {
git = null;
log(LogLevel.Error, `Failed to load git extension, is git installed?; ${error as string}`);
}