Skip to content

Commit

Permalink
Updated a lot of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
keesschollaart81 committed Aug 18, 2019
1 parent ca6bbc0 commit c769ce2
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 163 deletions.
119 changes: 47 additions & 72 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,24 @@
"vscode:prepublish": "tsc -p ./"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/node": "^12.6.8",
"@types/ws": "6.0.1",
"@types/mocha": "5.2.7",
"@types/node": "12.7.2",
"@types/ws": "6.0.2",
"@types/yaml": "1.0.2",
"ts-node": "8.3.0",
"tslint": "^5.18.0",
"typescript": "^3.4.5",
"typescript": "3.5.3",
"typescript-json-schema": "0.39.0",
"vscode": "^1.1.35"
"vscode": "^1.1.36"
},
"dependencies": {
"home-assistant-js-websocket": "4.0.0",
"ws": "6.2.0",
"home-assistant-js-websocket": "4.3.1",
"ws": "7.1.2",
"vscode-json-languageservice": "3.3.1",
"vscode-languageclient": "5.2.1",
"vscode-languageserver": "5.3.0-next.8",
"vscode-languageserver": "5.2.1",
"yaml-language-server": "0.5.3",
"yaml": "1.5.0",
"yaml": "1.6.0",
"vscode-extension-telemetry": "0.1.2"
}
}
73 changes: 0 additions & 73 deletions src/server/completionHelpers/utils.ts

This file was deleted.

28 changes: 23 additions & 5 deletions src/server/fileAccessor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IConnection, TextDocument, TextDocuments } from "vscode-languageserver";
import { TextDocuments } from "vscode-languageserver";
import * as fs from "fs";
import * as path from "path";
import Uri from 'vscode-uri';
Expand All @@ -15,7 +15,11 @@ export interface FileAccessor {

export class VsCodeFileAccessor implements FileAccessor {

constructor(private workspaceFolder: string, private connection: IConnection, private documents: TextDocuments) { }
private ourRoot: string;

constructor(private workspaceFolder: string, private documents: TextDocuments) {
this.ourRoot = path.resolve();
}

public async getFileContents(uri: string): Promise<string> {
var fullUri = Uri.file(path.resolve(uri));
Expand All @@ -38,6 +42,7 @@ export class VsCodeFileAccessor implements FileAccessor {

public getFilesInFolder(subFolder: string, filelist: string[] = []): string[] {
subFolder = path.normalize(subFolder);

try {
fs.readdirSync(subFolder).forEach(file => {
filelist = fs.statSync(path.join(subFolder, file)).isDirectory()
Expand All @@ -51,8 +56,21 @@ export class VsCodeFileAccessor implements FileAccessor {
return filelist;
}

private dealtWithRelativeFrom = (relativeFrom: string): string => {
if (relativeFrom.startsWith("file://")) {
relativeFrom = Uri.parse(relativeFrom).fsPath;
}
else {
if (!relativeFrom.startsWith(this.ourRoot)) {
relativeFrom = path.resolve(relativeFrom);
}
relativeFrom = Uri.file(relativeFrom).fsPath;
}
return relativeFrom;
}

public getFilesInFolderRelativeFrom(subFolder: string, relativeFrom: string): string[] {
relativeFrom = Uri.parse(relativeFrom).fsPath;
relativeFrom = this.dealtWithRelativeFrom(relativeFrom);

var dirOfFile = path.dirname(relativeFrom);
subFolder = path.join(dirOfFile, subFolder);
Expand All @@ -65,7 +83,7 @@ export class VsCodeFileAccessor implements FileAccessor {
}

public getRelativePath = (relativeFrom: string, filename: string): string => {
relativeFrom = Uri.parse(relativeFrom).fsPath;
relativeFrom = this.dealtWithRelativeFrom(relativeFrom);

var dirOfFile = path.dirname(relativeFrom);
let joinedPath = path.join(dirOfFile, filename);
Expand All @@ -81,7 +99,7 @@ export class VsCodeFileAccessor implements FileAccessor {
let workspaceFolderUri = Uri.parse(this.workspaceFolder);
let fileUri = Uri.parse(uri);
let local = fileUri.fsPath.replace(workspaceFolderUri.fsPath, "");
if (local[0] === "/" || local[0] === "\\"){
if (local[0] === "/" || local[0] === "\\") {
local = local.substring(1);
}
// let joined = path.join(workspaceFolderUri.fsPath, uri);
Expand Down
Loading

0 comments on commit c769ce2

Please sign in to comment.