-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
userManager.ts
40 lines (33 loc) · 972 Bytes
/
userManager.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as vscode from 'vscode';
export class UserManager {
private clients;
private ignoredclients;
constructor() {
this.clients = {};
this.ignoredclients = [];
}
setPosition(clientId, fileName, document, range, isReversed): void {
const documentUri = document.uri.toString();
const startOffset = document.offsetAt(range.start);
const endOffset = document.offsetAt(range.end);
this.clients[clientId] = {
fileName,
documentUri,
range,
isReversed,
startOffset,
endOffset
};
}
getPosition(clientId) {
if (this.ignoredclients.includes(clientId))
return null;
return this.clients[clientId];
}
removeClient(clientId): void {
delete this.clients[clientId];
}
addIgnoredClient(clientid): void {
this.ignoredclients.push(clientid);
}
}