我正在开发一个Visual Studio扩展项目,为Lua提供语言服务(此功能已经完成)。现在我要为Lua添加一个项目类型。现在项目中将有两个VsPackage类(一个用于lunguage服务,一个用于项目类型)。 当我调试项目时,项目类型似乎不起作用,单击“新建项目”时没有显示Lua项目类型。当我在一个空项目中测试它时,它运行良好。 这是第一个包:
[PackageRegistration(UseManagedResourcesOnly = true)]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
[ProvideProjectFactory(typeof(NPLProjectFactory), null,
"NPL Project Files (*.nplproj);*.nplproj", "nplproj", "nplproj",
".\\NullPath", LanguageVsTemplate = "NPL")]
[ProvideProjectItem(typeof(NPLProjectFactory), "NPL Items", ".\\NullPath", 500)]
[Guid(Guids.guidNPLProjectPkgString)]
[ProvideObject(typeof(NPLPropertyPage))]
[ProvideMenuResource("Menus.ctmenu", 1)]
public sealed class NPLProjectPackage : CommonProjectPackage
{
}
第二
[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[ProvideKeyBindingTable(GuidList.guidNPLLanguageServiceEditorFactoryString, 102)]
//[ProvideEditorLogicalView(typeof(EditorFactory), "{7651a703-06e5-11d1-8ebd-00a0c90f26ea}")]
[ProvideService(typeof(ILuaLanguageService), ServiceName = "NPL Language Service")]
// Provide the language service for the .lua extension
[ProvideLanguageExtension(typeof(LanguageService), Configuration.Extension)]
[ProvideLanguageService(typeof(LanguageService), Configuration.Name, 110,
CodeSense = true,
EnableCommenting = true,
MatchBraces = true,
MatchBracesAtCaret = true,
ShowCompletion = true,
ShowMatchingBrace = true,
AutoOutlining = true,
EnableAsyncCompletion = true,
QuickInfo = true,
EnableFormatSelection = true,
CodeSenseDelay = 1000)]
[ProvideToolWindow(typeof(SourceOutlineToolWindow), Style = VsDockStyle.Tabbed)]
//This attribute is needed to let the shell know that this package exposes some menus.
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideAutoLoad("F1536EF8-92EC-443C-9ED7-FDADF150DA82")] // = VSConstants.UICONTEXT_SolutionExists.ToString()
// there is bug in vs 2015 for associating language service with code expansion
// https://social.msdn.microsoft.com/Forums/vstudio/en-US/41f559c9-fa86-4108-b516-2d2fabd432a2/code-snippets-not-working-in-vs-2012?forum=vsx
[ProvideLanguageCodeExpansion(typeof(LanguageService), Configuration.Name, 110, Configuration.Name,
@"%InstallRoot%\NPL\Snippets\%LCID%\SnippetsIndex.xml",
// the paths of the snippet files
SearchPaths = @"%InstallRoot%\NPL\Snippets\%LCID%\Lua\;",
ForceCreateDirs = @"%InstallRoot%\NPL\Snippets\%LCID%\Lua\;")]
[Guid(GuidList.guidNPLLanguageServicePkgString)]
public sealed class NPLLanguageServicePackage : BasePackage
{
}
有没有人有任何想法?提前谢谢!
这是我的项目链接:https://github.com/LiXizhi/NPL