Error code search support offline mode

This commit is contained in:
Folyd 2021-10-01 12:49:36 +08:00
parent e8d61e46da
commit 38aac8f289

View file

@ -339,10 +339,11 @@ function getPlatformOs() {
let errorIndex = 'E' + String(baseIndex++).padStart(4, "0").toUpperCase();
result.push(errorIndex);
}
let baseUrl = settings.isOfflineMode ? settings.offlineDocPath : 'https://doc.rust-lang.org/';
return result.map(errorCode => {
return {
content: "https://doc.rust-lang.org/error-index.html#" + errorCode,
description: `Search Rust error index for ${c.match(errorCode)} on https://doc.rust-lang.org/error-index.html`,
content: `${baseUrl}error-index.html#${errorCode}`,
description: `Search Rust error index for ${c.match(errorCode)} on ${settings.isOfflineMode ? 'offline mode' : 'https://doc.rust-lang.org/error-index.html'}`,
};
});
},