Index: lib/snippets.js |
=================================================================== |
--- a/lib/snippets.js |
+++ b/lib/snippets.js |
@@ -17,17 +17,16 @@ |
"use strict"; |
/** |
* @fileOverview Snippets implementation. |
*/ |
const {EventEmitter} = require("./events"); |
-const {Filter} = require("./filterClasses"); |
const singleCharacterEscapes = new Map([ |
["n", "\n"], ["r", "\r"], ["t", "\t"] |
]); |
let filters = new Set(); |
/** |
@@ -51,47 +50,46 @@ |
/** |
* Add a new snippet filter |
* @param {SnippetFilter} filter |
*/ |
add(filter) |
{ |
let {size} = filters; |
- filters.add(filter.text); |
+ filters.add(filter); |
if (size != filters.size) |
this.emit("snippets.filterAdded", filter); |
}, |
/** |
* Removes a snippet filter |
* @param {SnippetFilter} filter |
*/ |
remove(filter) |
{ |
let {size} = filters; |
- filters.delete(filter.text); |
+ filters.delete(filter); |
if (size != filters.size) |
this.emit("snippets.filterRemoved", filter); |
}, |
/** |
* Returns a list of all snippet filters active on a particular domain |
* @param {string} domain |
* @return {Array.<SnippetFilter>} |
*/ |
getFiltersForDomain(domain) |
{ |
let result = []; |
- for (let text of filters) |
+ for (let filter of filters) |
{ |
- let filter = Filter.fromText(text); |
if (filter.isActiveOnDomain(domain)) |
result.push(filter); |
} |
return result; |
} |
}); |
exports.Snippets = Snippets; |