|
5 | 5 |
|
6 | 6 | import * as nls from 'vs/nls'; |
7 | 7 |
|
8 | | -import * as crypto from 'crypto'; |
9 | | - |
10 | 8 | import * as Objects from 'vs/base/common/objects'; |
11 | 9 |
|
12 | 10 | import { TaskIdentifier, KeyedTaskIdentifier, TaskDefinition } from 'vs/workbench/contrib/tasks/common/tasks'; |
13 | 11 | import { TaskDefinitionRegistry } from 'vs/workbench/contrib/tasks/common/taskDefinitionRegistry'; |
14 | 12 |
|
15 | 13 | namespace KeyedTaskIdentifier { |
16 | | - export function create(value: TaskIdentifier): KeyedTaskIdentifier { |
17 | | - const hash = crypto.createHash('md5'); |
18 | | - hash.update(JSON.stringify(value)); |
19 | | - let result = { _key: hash.digest('hex'), type: value.taskType }; |
20 | | - Objects.assign(result, value); |
| 14 | + function sortedStringify(literal: any): string { |
| 15 | + const keys = Object.keys(literal).sort(); |
| 16 | + let result: string = ''; |
| 17 | + for (let position in keys) { |
| 18 | + let stringified = literal[keys[position]]; |
| 19 | + if (stringified instanceof Object) { |
| 20 | + stringified = sortedStringify(test); |
| 21 | + } else if (typeof stringified === 'string') { |
| 22 | + stringified = stringified.replace(/,/g, ',,'); |
| 23 | + } |
| 24 | + result += keys[position] + ',' + stringified + ','; |
| 25 | + } |
21 | 26 | return result; |
22 | 27 | } |
| 28 | + export function create(value: TaskIdentifier): KeyedTaskIdentifier { |
| 29 | + const resultKey = sortedStringify(value); |
| 30 | + console.log(resultKey); |
| 31 | + return { _key: resultKey, type: value.taskType }; |
| 32 | + } |
23 | 33 | } |
24 | 34 |
|
25 | 35 | namespace TaskDefinition { |
|
0 commit comments