Fixing file extension checks. Resolves #63 (#76)

Signed-off-by: Kuba Wolanin <hi@kubawolanin.com>
pull/77/head
Kuba Wolanin 2017-12-30 16:46:00 +01:00 committed by GitHub
parent 1b02f71697
commit 3cda944e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -41,7 +41,7 @@ export class RuleProvider {
let editor = window.activeTextEditor
let document = editor.document
if (document.fileName.split('.')[1] === 'rules') {
if (document.fileName.endsWith('rules')) {
let position = editor.selection.active
let newPosition = position.with(position.line, 0)

View File

@ -39,7 +39,7 @@ export class SitemapPartialProvider {
let editor = window.activeTextEditor
let document = editor.document
if (document.fileName.split('.')[1] === 'sitemap') {
if (document.fileName.endsWith('sitemap')) {
editor.insertSnippet(SNIPPET_TEMPLATE(this.item), editor.selection.active)
} else {
window.showInformationMessage('Please open "*.sitemap" file in the editor to add a new snippet.')

View File

@ -76,7 +76,7 @@ export class ItemsProvider {
let editor = window.activeTextEditor
let document = editor.document
if (document.fileName.split('.')[1] === 'items') {
if (document.fileName.endsWith('items')) {
let template
if (this.treeItem.treeItemType === 'thing') {

View File

@ -54,7 +54,7 @@ async function init(context: ExtensionContext, disposables: Disposable[], config
let fileName = path.basename(absolutePath)
let ui = config.sitemapPreviewUI
if (fileName.split('.')[1] === 'sitemap') {
if (fileName.endsWith('sitemap')) {
let sitemap = fileName.split('.')[0]
return openUI({
route: `/${ui}/app?sitemap=${sitemap}`,