-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7039 from dibarbet/package_xaml_content
Package xaml content
- Loading branch information
Showing
10 changed files
with
216 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ node_modules | |
out | ||
.roslyn/ | ||
.roslynDevKit/ | ||
.xamlTools/ | ||
.omnisharp/ | ||
.omnisharp-*/ | ||
.vs/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import { LanguageServerOptions } from '../shared/options'; | ||
|
||
interface ComponentInfo { | ||
defaultFolderName: string; | ||
optionName: string; | ||
componentDllPaths: string[]; | ||
} | ||
|
||
export const componentInfo: { [key: string]: ComponentInfo } = { | ||
roslynDevKit: { | ||
defaultFolderName: '.roslynDevKit', | ||
optionName: 'roslynDevKit', | ||
componentDllPaths: ['Microsoft.VisualStudio.LanguageServices.DevKit.dll'], | ||
}, | ||
xamlTools: { | ||
defaultFolderName: '.xamlTools', | ||
optionName: 'xamlTools', | ||
componentDllPaths: [ | ||
'Microsoft.VisualStudio.DesignTools.CodeAnalysis.dll', | ||
'Microsoft.VisualStudio.DesignTools.CodeAnalysis.Diagnostics.dll', | ||
], | ||
}, | ||
}; | ||
|
||
export function getComponentPaths(componentName: string, options: LanguageServerOptions): string[] { | ||
const component = componentInfo[componentName]; | ||
const baseFolder = getComponentFolderPath(component, options); | ||
const paths = component.componentDllPaths.map((dllPath) => path.join(baseFolder, dllPath)); | ||
for (const dllPath of paths) { | ||
if (!fs.existsSync(dllPath)) { | ||
throw new Error(`Component DLL not found: ${dllPath}`); | ||
} | ||
} | ||
|
||
return paths; | ||
} | ||
|
||
export function getComponentFolder(componentName: string, options: LanguageServerOptions): string { | ||
const component = componentInfo[componentName]; | ||
return getComponentFolderPath(component, options); | ||
} | ||
|
||
function getComponentFolderPath(component: ComponentInfo, options: LanguageServerOptions): string { | ||
if (options.componentPaths) { | ||
const optionValue = options.componentPaths[component.optionName]; | ||
if (optionValue) { | ||
return optionValue; | ||
} | ||
} | ||
|
||
return path.join(__dirname, '..', component.defaultFolderName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.