Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
Merged branch master into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Togusa09 committed Jun 11, 2016
2 parents 6f3c5f6 + 465b330 commit 4757d44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tmlanguage",
"displayName": "TextMate Languages",
"description": "Syntax highlighter and snippets for JSON/YAML derivitives of TextMate language definition",
"version": "0.0.7",
"version": "0.7.1",
"publisher": "Togusa09",
"license": "MIT",
"engines": {
Expand Down
16 changes: 8 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
import {join, basename} from 'path';
import * as path from 'path';

var plist = require('plist');
var json = require('format-json');
Expand Down Expand Up @@ -91,7 +91,7 @@ class FileConverter{
return;
}
let doc = editor.document;
var filename = doc.fileName.split("\\").pop().split('.').shift();
var parsedFilePath = path.parse(doc.fileName);

try{
var extension: string;
Expand Down Expand Up @@ -120,18 +120,18 @@ class FileConverter{
var sourceLanguage = doc.languageId;

// check to see if file already exists
vscode.workspace.findFiles(filename + "*." + extension, "ABC").then(matchingFiles => {
vscode.workspace.findFiles(parsedFilePath.name + "*." + extension, "ABC").then(matchingFiles => {
var paths = matchingFiles.map(p => p.fsPath);

var path = join(vscode.workspace.rootPath, './' + filename + '.' + extension);
var newFilePath = path.join(parsedFilePath.dir, './' + parsedFilePath.name + '.' + extension);
if (matchingFiles.length != 0){
var counter = 1;
while (paths.indexOf(path) >= 0){
path = join(vscode.workspace.rootPath, './' + filename + '(' + counter +').' + extension);
while (paths.indexOf(newFilePath) >= 0){
newFilePath = path.join(parsedFilePath.dir, './' + parsedFilePath.name + '(' + counter +').' + extension);
counter++;
}
}
this.OpenTextDocument(sourceLanguage, destinationLanguage, documentText, path);
this.OpenTextDocument(sourceLanguage, destinationLanguage, documentText, newFilePath);
});
} catch(err) {
console.log(err);
Expand Down Expand Up @@ -178,6 +178,6 @@ class FileConverter{
}

dispose() {
//this._statusBarItem.dispose();

}
}

0 comments on commit 4757d44

Please sign in to comment.