mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-25 22:30:29 -04:00
Revert "Revert "Merge from vscode ada4bddb8edc69eea6ebaaa0e88c5f903cbd43d8 (#5529)" (#5553)" (#5562)
This reverts commit c9a4f8f664.
This commit is contained in:
@@ -197,7 +197,11 @@ function guessMimeTypeByFirstline(firstLine: string): string | null {
|
||||
}
|
||||
|
||||
if (firstLine.length > 0) {
|
||||
for (const association of registeredAssociations) {
|
||||
|
||||
// We want to prioritize associations based on the order they are registered so that the last registered
|
||||
// association wins over all other. This is for https://github.com/Microsoft/vscode/issues/20074
|
||||
for (let i = registeredAssociations.length - 1; i >= 0; i--) {
|
||||
const association = registeredAssociations[i];
|
||||
if (!association.firstline) {
|
||||
continue;
|
||||
}
|
||||
@@ -230,10 +234,11 @@ export function isUnspecific(mime: string[] | string): boolean {
|
||||
* 2. Otherwise, if there are other extensions, suggest the first one.
|
||||
* 3. Otherwise, suggest the prefix.
|
||||
*/
|
||||
export function suggestFilename(langId: string | null, prefix: string): string {
|
||||
export function suggestFilename(mode: string | undefined, prefix: string): string {
|
||||
const extensions = registeredAssociations
|
||||
.filter(assoc => !assoc.userConfigured && assoc.extension && assoc.id === langId)
|
||||
.filter(assoc => !assoc.userConfigured && assoc.extension && assoc.id === mode)
|
||||
.map(assoc => assoc.extension);
|
||||
|
||||
const extensionsWithDotFirst = coalesce(extensions)
|
||||
.filter(assoc => startsWith(assoc, '.'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user