mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 01:48:18 +00:00
use a specialised map for handling case-insenstive file uris
This commit is contained in:
@@ -61,6 +61,54 @@ function positionAt(index, content) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A specialised Map to allow for case-insensitive fileURIs on Windows.
|
||||
*
|
||||
* For cs-filesystems, this should work as a normal map.
|
||||
* For ci-filesystems, if a file URI case changes, it should be picked up
|
||||
* by the lowercase map
|
||||
*/
|
||||
class FileURIMap extends Map {
|
||||
lowerMap = new Map();
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
*/
|
||||
get(key) {
|
||||
return super.get(key) || this.lowerMap.get(key.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
*/
|
||||
has(key) {
|
||||
return super.has(key) || this.lowerMap.has(key.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {*} value
|
||||
*/
|
||||
set(key, value) {
|
||||
super.set(key, value);
|
||||
this.lowerMap.set(key.toLowerCase(), value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
*/
|
||||
delete(key) {
|
||||
this.lowerMap.delete(key.toLowerCase());
|
||||
return super.delete(key);
|
||||
}
|
||||
|
||||
clear() {
|
||||
super.clear();
|
||||
this.lowerMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for storing data about Java source files
|
||||
*/
|
||||
@@ -376,6 +424,7 @@ async function loadWorkingFileList(src_folder) {
|
||||
|
||||
exports.indexAt = indexAt;
|
||||
exports.positionAt = positionAt;
|
||||
exports.FileURIMap = FileURIMap;
|
||||
exports.JavaDocInfo = JavaDocInfo;
|
||||
exports.ParsedInfo = ParsedInfo;
|
||||
exports.reparse = reparse;
|
||||
|
||||
@@ -16,7 +16,7 @@ const { Settings } = require('./settings');
|
||||
const { trace } = require('./logging');
|
||||
const { getCompletionItems, resolveCompletionItem } = require('./completions');
|
||||
const { getSignatureHelp } = require('./method-signatures');
|
||||
const { getAppSourceRootFolder, JavaDocInfo, indexAt, reparse, rescanSourceFolders } = require('./document');
|
||||
const { getAppSourceRootFolder, FileURIMap, JavaDocInfo, indexAt, reparse, rescanSourceFolders } = require('./document');
|
||||
|
||||
/**
|
||||
* The global map of Android system types
|
||||
@@ -29,7 +29,7 @@ let androidLibrary = null;
|
||||
* The list of loaded Java documents
|
||||
* @type {Map<string,JavaDocInfo>}
|
||||
*/
|
||||
const liveParsers = new Map();
|
||||
const liveParsers = new FileURIMap();
|
||||
|
||||
let hasConfigurationCapability = false;
|
||||
let hasWorkspaceFolderCapability = false;
|
||||
|
||||
Reference in New Issue
Block a user