Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesaulniers committed Feb 6, 2021
1 parent de5c2c2 commit 6574260
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ function throttle(threshold: number, fn: Function): any {
var now = + new Date;

if (last && now < last + threshold) {
console.log("Not ready yet!");
clearTimeout(deferTimer);

deferTimer = setTimeout(function () {
Expand Down Expand Up @@ -241,7 +240,7 @@ async function _feedTypeInfoCache(uri: string) {
typesCommandCache.set(uri, result);
}

let _feedTypeInfoCacheThrottle = throttle(2000, _feedTypeInfoCache);
let _feedTypeInfoCacheThrottle = throttle(1000, _feedTypeInfoCache);

let feedTypeInfoCache = (uri: string) => {
_feedTypeInfoCacheThrottle(uri);
Expand Down Expand Up @@ -271,15 +270,15 @@ async function showErrorMessage(message: string, ...actions: MessageActionItem[]

// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent(async change => {
documents.onDidChangeContent(change => {
validateTextDocument(change.document);

// Put new `tl types` data in cache
feedTypeInfoCache(change.document.uri);
});

// Monitored files have changed in VS Code
connection.onDidChangeWatchedFiles(async _change => {
connection.onDidChangeWatchedFiles(_change => {
for (let x of documents.all()) {
validateTextDocument(x);

Expand Down

0 comments on commit 6574260

Please sign in to comment.