├── .editorconfig ├── .gitattributes ├── .gitignore ├── README.md ├── icon.png ├── install ├── .gitignore └── resharper-angularjs.nuspec ├── license.txt ├── src ├── resharper-angularjs.sln ├── resharper-angularjs.sln.DotSettings └── resharper-angularjs │ ├── Daemon │ └── AngularJs │ │ └── Stages │ │ ├── AngularJsDaemonStageBase.cs │ │ ├── AngularJsIdentifierHighlighterProcess.cs │ │ └── IdentifierHighlightingStage.cs │ ├── Feature │ └── Services │ │ ├── Caches │ │ ├── AngularJsCache.cs │ │ ├── AngularJsCacheItems.cs │ │ ├── AngularJsCacheItemsBuilder.cs │ │ ├── Directive.cs │ │ ├── DirectiveUtil.cs │ │ ├── Filter.cs │ │ ├── JsDocFileProcessor.cs │ │ ├── JsInvocationProcessor.cs │ │ └── Parameter.cs │ │ ├── CodeCompletion │ │ ├── AbbreviatedItemsProvider.cs │ │ ├── AbbreviatedTextLookupItem.cs │ │ ├── OverriddenAngularJsItemsRemover.cs │ │ └── WrappedDynamicLookupItem.cs │ │ └── Descriptions │ │ └── AngularJsHtmlElementDescriptionProvider.cs │ ├── Hacks │ ├── CodeCompletion │ │ ├── AutomaticTagItemsProvider.cs │ │ └── TemplateWithNonDefaultPrefixesItemsProvider.cs │ └── LiveTemplates │ │ └── Scope │ │ ├── DelegatingScopePoint.cs │ │ ├── JsAllowedPrefixes.cs │ │ ├── NonDefaultPrefixJavaScriptScopeProvider.cs │ │ ├── NonDefaultPrefixWrappingScopeProvider.cs │ │ ├── ReplacingAllowedPrefixCharsScopePoint.cs │ │ └── TypeScriptFilePrefixScopeProvider.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Psi │ ├── AngularJs │ │ ├── AngularJsLanguage.cs │ │ ├── AngularJsLanguageService.cs │ │ ├── CodeStyle │ │ │ ├── AngularJsCodeFormatter.cs │ │ │ ├── AngularJsFormattingInfoProvider.cs │ │ │ └── AngularJsIndentingInfoProvider.cs │ │ ├── InjectedPsiProvider.cs │ │ ├── Parsing │ │ │ ├── Angular.lex │ │ │ ├── AngularJsLexer.cs │ │ │ ├── AngularJsParser.cs │ │ │ ├── AngularJsTokenType.Tokens.xml │ │ │ ├── AngularJsTokenType.cs │ │ │ ├── AngularJsTokenType.generated.cs │ │ │ ├── AngularJsTreeBuilder.cs │ │ │ ├── Angular_lex.cs │ │ │ └── Tree │ │ │ │ ├── AngularJsElementType.cs │ │ │ │ ├── FilterArgumentList.cs │ │ │ │ ├── FilterExpression.8.2.cs │ │ │ │ ├── FilterExpression.9.0.cs │ │ │ │ ├── FilterExpression.cs │ │ │ │ ├── RepeatExpression.8.2.cs │ │ │ │ ├── RepeatExpression.9.0.cs │ │ │ │ └── RepeatExpression.cs │ │ ├── References │ │ │ ├── AngularJsFileLateBoundReference.cs │ │ │ ├── AngularJsFolderLateBoundReference.cs │ │ │ ├── AngularJsIncludeFileReferenceProvider.cs │ │ │ ├── AngularJsReferenceFactoryBase.cs │ │ │ └── IgnoreRootPathFilter.cs │ │ └── Tree │ │ │ ├── AngularJsFileData.cs │ │ │ └── AngularJsNodeTypes.cs │ ├── Html │ │ ├── AngularJsDeclaredElementIconProvider.cs │ │ ├── AngularJsHtmlAttributeDeclaredElement.cs │ │ ├── AngularJsHtmlElementsProvider.cs │ │ ├── AngularJsHtmlTagDeclaredElement.cs │ │ └── IAngularJsDeclaredElement.cs │ └── JavaScript │ │ └── Resolve │ │ └── AngularServiceTypeInfoSupplier.cs │ ├── Resources │ └── Logo │ │ ├── ThemedIcons.Logo.Generated.Xaml │ │ ├── ThemedIcons.Logo.Generated.cs │ │ └── angularjs-logo.xaml │ ├── TreeNodeExtensions.cs │ ├── ZoneMarker.cs │ ├── resharper-angularjs.csproj │ ├── resharper-angularjs.csproj.DotSettings │ └── templates.dotSettings ├── test ├── data │ ├── Caches │ │ ├── CacheDefaultAngularDirectives12.gold │ │ ├── CacheDefaultAngularDirectives13.gold │ │ ├── CacheDefaultAngularDirectives14.gold │ │ ├── CacheDefaultAngularFilters12.gold │ │ ├── CacheDefaultAngularFilters13.gold │ │ ├── CacheDefaultAngularFilters14.gold │ │ ├── DirectiveFromSourceWithInjectedFunction.gold │ │ ├── DirectiveFromSourceWithInjectedFunction.js │ │ ├── DirectiveFromSourceWithRestrictProperty.gold │ │ ├── DirectiveFromSourceWithRestrictProperty.js │ │ ├── SimpleDirectiveFromSource.gold │ │ └── SimpleDirectiveFromSource.js │ ├── CodeCompletion │ │ ├── Double │ │ │ └── List │ │ │ │ ├── ShowAllItemsOnDoubleCompletionWithNoPrefix.html │ │ │ │ ├── ShowAllItemsOnDoubleCompletionWithNoPrefix.html12.gold │ │ │ │ ├── ShowAllItemsOnDoubleCompletionWithNoPrefix.html13.gold │ │ │ │ ├── ShowAllItemsOnDoubleCompletionWithNoPrefix.html14.gold │ │ │ │ ├── ShowMatchingItemsOnDoubleCompletionWithPrefix.html │ │ │ │ ├── ShowMatchingItemsOnDoubleCompletionWithPrefix.html12.gold │ │ │ │ ├── ShowMatchingItemsOnDoubleCompletionWithPrefix.html13.gold │ │ │ │ └── ShowMatchingItemsOnDoubleCompletionWithPrefix.html14.gold │ │ └── List │ │ │ ├── DoesNotIncludeAttributesAlreadyUsed.html │ │ │ ├── DoesNotIncludeAttributesAlreadyUsed.html12.gold │ │ │ ├── DoesNotIncludeAttributesAlreadyUsed.html13.gold │ │ │ ├── DoesNotIncludeAttributesAlreadyUsed.html14.gold │ │ │ ├── ShowAbbreviationsWithMatchingPrefix.html │ │ │ ├── ShowAbbreviationsWithMatchingPrefix.html12.gold │ │ │ ├── ShowAbbreviationsWithMatchingPrefix.html13.gold │ │ │ ├── ShowAbbreviationsWithMatchingPrefix.html14.gold │ │ │ ├── ShowAbbreviationsWithNoPrefix.html │ │ │ ├── ShowAbbreviationsWithNoPrefix.html12.gold │ │ │ ├── ShowAbbreviationsWithNoPrefix.html13.gold │ │ │ ├── ShowAbbreviationsWithNoPrefix.html14.gold │ │ │ ├── ShowItemsWithCaretInMiddleOfCompletionPrefix.html │ │ │ ├── ShowItemsWithCaretInMiddleOfCompletionPrefix.html12.gold │ │ │ ├── ShowItemsWithCaretInMiddleOfCompletionPrefix.html13.gold │ │ │ ├── ShowItemsWithCaretInMiddleOfCompletionPrefix.html14.gold │ │ │ ├── ShowItemsWithExactAbbreviationMatch.html │ │ │ ├── ShowItemsWithExactAbbreviationMatch.html12.gold │ │ │ ├── ShowItemsWithExactAbbreviationMatch.html13.gold │ │ │ ├── ShowItemsWithExactAbbreviationMatch.html14.gold │ │ │ ├── ShowItemsWithPatternAbbreviationMatch.html │ │ │ ├── ShowItemsWithPatternAbbreviationMatch.html12.gold │ │ │ ├── ShowItemsWithPatternAbbreviationMatch.html13.gold │ │ │ ├── ShowItemsWithPatternAbbreviationMatch.html14.gold │ │ │ ├── ShowItemsWithPatternIncludingAbbreviation.html │ │ │ ├── ShowItemsWithPatternIncludingAbbreviation.html12.gold │ │ │ ├── ShowItemsWithPatternIncludingAbbreviation.html13.gold │ │ │ ├── ShowItemsWithPatternIncludingAbbreviation.html14.gold │ │ │ ├── ShowItemsWithPatternNotIncludingAbbreviation.html │ │ │ ├── ShowItemsWithPatternNotIncludingAbbreviation.html12.gold │ │ │ ├── ShowItemsWithPatternNotIncludingAbbreviation.html13.gold │ │ │ └── ShowItemsWithPatternNotIncludingAbbreviation.html14.gold │ ├── angular.1.2.28.js │ ├── angular.1.3.15.js │ ├── angular.1.4.0.js │ ├── nuget.config │ └── psi │ │ ├── Html │ │ └── ElementsProvider │ │ │ ├── GetAllAttributesSymbolTable12.gold │ │ │ ├── GetAllAttributesSymbolTable13.gold │ │ │ ├── GetAllAttributesSymbolTable14.gold │ │ │ ├── GetAllTagsSymbolTable12.gold │ │ │ ├── GetAllTagsSymbolTable13.gold │ │ │ ├── GetAllTagsSymbolTable14.gold │ │ │ ├── GetAttributeInfoForCommonAttributes12.gold │ │ │ ├── GetAttributeInfoForCommonAttributes13.gold │ │ │ ├── GetAttributeInfoForCommonAttributes14.gold │ │ │ ├── GetAttributeInfoForSpecificTag12.gold │ │ │ ├── GetAttributeInfoForSpecificTag13.gold │ │ │ ├── GetAttributeInfoForSpecificTag14.gold │ │ │ ├── GetCommonAttributesSymbolTable12.gold │ │ │ ├── GetCommonAttributesSymbolTable13.gold │ │ │ ├── GetCommonAttributesSymbolTable14.gold │ │ │ ├── GetTagForAngularTag12.gold │ │ │ ├── GetTagForAngularTag13.gold │ │ │ └── GetTagForAngularTag14.gold │ │ ├── JavaScript │ │ └── Resolve │ │ │ └── DependencyInjection │ │ │ ├── InjectBuiltinServices.js │ │ │ ├── InjectBuiltinServices.js.gold │ │ │ ├── InjectBuiltinServicesByStringLiteral.js │ │ │ ├── InjectBuiltinServicesByStringLiteral.js.gold │ │ │ ├── InjectByStringLiteral.js │ │ │ ├── InjectByStringLiteral.js.gold │ │ │ ├── InjectFactory.js │ │ │ ├── InjectFactory.js.gold │ │ │ ├── InjectFunctionConstant.js │ │ │ ├── InjectFunctionConstant.js.gold │ │ │ ├── InjectFunctionValue.js │ │ │ ├── InjectFunctionValue.js.gold │ │ │ ├── InjectIntoAnimation.js │ │ │ ├── InjectIntoAnimation.js.gold │ │ │ ├── InjectIntoConfig.js │ │ │ ├── InjectIntoConfig.js.gold │ │ │ ├── InjectIntoController.js │ │ │ ├── InjectIntoController.js.gold │ │ │ ├── InjectIntoDirective.js │ │ │ ├── InjectIntoDirective.js.gold │ │ │ ├── InjectIntoFactory.js │ │ │ ├── InjectIntoFactory.js.gold │ │ │ ├── InjectIntoFilter.js │ │ │ ├── InjectIntoFilter.js.gold │ │ │ ├── InjectIntoProvider.js │ │ │ ├── InjectIntoProvider.js.gold │ │ │ ├── InjectIntoRun.js │ │ │ ├── InjectIntoRun.js.gold │ │ │ ├── InjectIntoService.js │ │ │ ├── InjectIntoService.js.gold │ │ │ ├── InjectNumberConstant.js │ │ │ ├── InjectNumberConstant.js.gold │ │ │ ├── InjectProvider.js │ │ │ ├── InjectProvider.js.gold │ │ │ ├── InjectProviderValue.js │ │ │ ├── InjectProviderValue.js.gold │ │ │ ├── InjectService.js │ │ │ ├── InjectService.js.gold │ │ │ ├── InjectStringConstant.js │ │ │ ├── InjectStringConstant.js.gold │ │ │ ├── InjectStringValue.js │ │ │ └── InjectStringValue.js.gold │ │ ├── lexing │ │ ├── expression.js │ │ ├── expression.js.gold │ │ ├── identifier.js │ │ ├── identifier.js.gold │ │ ├── key_value.js │ │ ├── key_value.js.gold │ │ ├── keyword.js │ │ ├── keyword.js.gold │ │ ├── number.js │ │ ├── number.js.gold │ │ ├── string.js │ │ └── string.js.gold │ │ └── parsing │ │ ├── array.js │ │ ├── array.js.gold │ │ ├── comparison.js │ │ ├── comparison.js.gold │ │ ├── expressions.js │ │ ├── filters.js │ │ ├── filters.js.gold │ │ ├── in.js │ │ ├── in.js.gold │ │ ├── logical.js │ │ ├── logical.js.gold │ │ ├── object.js │ │ ├── object.js.gold │ │ ├── repeat_expressions.js │ │ ├── repeat_expressions.js.gold │ │ ├── statements.js │ │ ├── statements.js.gold │ │ ├── string.js │ │ ├── string.js.gold │ │ ├── ternary.js │ │ └── ternary.js.gold └── src │ └── test.resharper-angularjs │ ├── AngularJsTestVersions.cs │ ├── Feature │ └── Services │ │ ├── Caches │ │ ├── DirectivesCacheTest.cs │ │ └── FiltersCacheTest.cs │ │ └── CodeCompletion │ │ ├── AngularJsAttributesCompletionListTest.cs │ │ └── AngularJsAttributesDoubleCompletionListTest.cs │ ├── Psi │ ├── AngularJs │ │ ├── AngularJsLanguageTests.cs │ │ └── Parsing │ │ │ ├── AngularJsLexerTest.cs │ │ │ └── AngularJsParserTest.cs │ ├── Html │ │ └── AngularJsHtmlElementsProviderTest.cs │ └── JavaScript │ │ ├── DependencyInjectionTest.cs │ │ └── JavaScriptResolveTestBase.cs │ ├── TestEnvironment.cs │ ├── tests.csproj │ └── tests.csproj.DotSettings └── updates.xslt /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Packages/ 2 | bin/ 3 | obj/ 4 | *.user 5 | *.suo 6 | 7 | _ReSharper.* 8 | /src/.vs/resharper-angularjs/v15/* 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![official JetBrains project](http://jb.gg/badges/official-flat-square.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) 2 | 3 | # resharper-angularjs 4 | 5 | A plugin for ReSharper that adds support for AngularJS. 6 | 7 | ## What does it do? 8 | 9 | This plugin adds the following features: 10 | 11 | * Code completion for AngularJS elements and attributes in HTML files. It supports the standard `ng-` syntax, as well as the `data-ng-` and `x-ng-` forms. 12 | * Improved code completion for injected services in controllers, directives, filters, etc. ReSharper knows the type of injected services and shows improved code completion for properties of these services and providers. 13 | * Live Templates for HTML, JavaScript and TypeScript. The templates are grouped into helpers for module, directive, scope, global, html and routing. They can be seen and edited in the Templates Explorer. 14 | 15 | The Live Templates are based on the IntelliJ templates by [Pawel Kozlowski](https://github.com/angularjs-livetpls/angularjs-webstorm-livetpls). 16 | 17 | ## How do I get it? 18 | 19 | You can install directly into ReSharper via the Extension Manager in the ReSharper menu. 20 | 21 | Packages for previous versions are still available on the Extension Manager. 22 | 23 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JetBrains/resharper-angularjs/b2e086d8657c1d4e6b84061340fa87b979758085/icon.png -------------------------------------------------------------------------------- /install/.gitignore: -------------------------------------------------------------------------------- 1 | AngularJS*/ 2 | *.zip 3 | *.nupkg 4 | -------------------------------------------------------------------------------- /install/resharper-angularjs.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | JetBrains.AngularJS 5 | AngularJS 6 | 1.11.0 7 | JetBrains 8 | JetBrains 9 | false 10 | https://github.com/JetBrains/resharper-angularjs 11 | https://raw.github.com/JetBrains/resharper-angularjs/master/license.txt 12 | https://raw.github.com/JetBrains/resharper-angularjs/master/icon.png 13 | Code completion and live templates for AngularJS 14 | • Updated to ReSharper 2017.3.1 15 | 16 | From 1.11.0: 17 | • Updated to ReSharper 2017.3.1 18 | 19 | From 1.8.0: 20 | • Updated to ReSharper 2017.1 21 | 22 | From 1.7.0: 23 | • Updated to ReSharper 2016.3 24 | 25 | From 1.6.2: 26 | • Address performance issue with many directives. 27 | 28 | From 1.6.1: 29 | • Updated to ReSharper 2016.2 30 | • Initial 1.6.0 release was incorrect, re-compiled and re-released as 1.6.1 31 | 32 | From 1.5.1: 33 | • Fixed exceptions in ReSharper 2016.1.2 34 | • Fixed warning if directive is declared in code and JSDoc 35 | 36 | From 1.5.0: 37 | • Support for ReSharper 2016.1 38 | • Addressing performance issues while typing (#45) 39 | 40 | From 1.4.1: 41 | • Support for ReSharper 10 (#39) 42 | • Fixed multiple directives in JSX files 43 | 44 | From 1.3.1: 45 | • Support for ReSharper 9.2 (#33) 46 | • HTML elements and attributes dynamically parsed from ngDoc comments (#6, #30, #32) 47 | • Improve code completion for injected services (#7) 48 | 49 | From 1.2.2: 50 | • Tweaked sort order to put ng- items above data-ng- 51 | • Added angular icons to the code completion items 52 | 53 | 54 | 55 | 56 | resharper angular angularjs javascript js typescript 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/resharper-angularjs.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.4 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resharper-angularjs", "resharper-angularjs\resharper-angularjs.csproj", "{B66C17A3-9499-4AD6-93CE-DC8B2823BEF2}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "..\test\src\test.resharper-angularjs\tests.csproj", "{8E0BE7C0-CB94-4993-94F3-A91961F8A809}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {B66C17A3-9499-4AD6-93CE-DC8B2823BEF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {B66C17A3-9499-4AD6-93CE-DC8B2823BEF2}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {B66C17A3-9499-4AD6-93CE-DC8B2823BEF2}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {B66C17A3-9499-4AD6-93CE-DC8B2823BEF2}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {8E0BE7C0-CB94-4993-94F3-A91961F8A809}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {8E0BE7C0-CB94-4993-94F3-A91961F8A809}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {8E0BE7C0-CB94-4993-94F3-A91961F8A809}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {8E0BE7C0-CB94-4993-94F3-A91961F8A809}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /src/resharper-angularjs.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | license 3 | Copyright 2015 JetBrains s.r.o. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | 18 | 19 | True 20 | C:\Users\matt\Code\forks\GitHub\JetBrains-resharper-angularjs\src\resharper-angularjs\templates.dotSettings 21 | ..\resharper-angularjs\templates.dotSettings 22 | 23 | 24 | 25 | 26 | 27 | True 28 | 3 29 | False 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <data><IncludeFilters /><ExcludeFilters /></data> 43 | <data /> 44 | -------------------------------------------------------------------------------- /src/resharper-angularjs/Daemon/AngularJs/Stages/AngularJsDaemonStageBase.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using JetBrains.Application.Settings; 20 | using JetBrains.ReSharper.Feature.Services.Daemon; 21 | using JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs; 22 | using JetBrains.ReSharper.Psi; 23 | using JetBrains.ReSharper.Psi.Files; 24 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 25 | using JetBrains.Util; 26 | 27 | namespace JetBrains.ReSharper.Plugins.AngularJS.Daemon.AngularJs.Stages 28 | { 29 | public abstract class AngularJsDaemonStageBase : IDaemonStage 30 | { 31 | public IEnumerable CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind) 32 | { 33 | if (!IsSupported(process.SourceFile)) 34 | return Enumerable.Empty(); 35 | 36 | process.SourceFile.GetPsiServices().Files.AssertAllDocumentAreCommitted(); 37 | 38 | return process.SourceFile.GetPsiFiles() 39 | .SelectNotNull(file => CreateProcess(process, settings, processKind, (IJavaScriptFile)file)); 40 | } 41 | 42 | protected abstract IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, 43 | DaemonProcessKind processKind, IJavaScriptFile file); 44 | 45 | public abstract ErrorStripeRequest NeedsErrorStripe(IPsiSourceFile sourceFile, IContextBoundSettingsStore settings); 46 | 47 | protected static bool IsSupported(IPsiSourceFile sourceFile) 48 | { 49 | if (sourceFile == null || !sourceFile.IsValid()) 50 | return false; 51 | 52 | return sourceFile.IsLanguageSupported(); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Daemon/AngularJs/Stages/AngularJsIdentifierHighlighterProcess.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Application.Settings; 18 | using JetBrains.ReSharper.Daemon.JavaScript.Stages; 19 | using JetBrains.ReSharper.Feature.Services.Daemon; 20 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Daemon.AngularJs.Stages 23 | { 24 | // We need to derive from IdentifierHighlighterProcess because IHP is used by 25 | // JavaScript's IdentifierHighlightingStage, and is keyed on that type. Our 26 | // IdentifierHighlightingStage therefore must return a different process 27 | // TODO: We might want to build our own, and always highlight identifiers, or at least keywords 28 | // TODO: Implement IJavaScriptIdentifierHighlighter for syntax highlighting 29 | // Need to mark with [Language(typeof(AngularJsLanguage))] 30 | public class AngularJsIdentifierHighlighterProcess : IdentifierHighlighterProcess 31 | { 32 | public AngularJsIdentifierHighlighterProcess(ResolveHighlighterRegistrar resolveHighlighterRegistrar, IDaemonProcess daemonProcess, 33 | IContextBoundSettingsStore settingsStore, IJavaScriptFile file, DaemonProcessKind processKind) 34 | : base(resolveHighlighterRegistrar, daemonProcess, settingsStore, file, processKind) 35 | { 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Daemon/AngularJs/Stages/IdentifierHighlightingStage.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Application.Settings; 18 | using JetBrains.ReSharper.Daemon.JavaScript.Stages.SmartResolver; 19 | using JetBrains.ReSharper.Feature.Services.Daemon; 20 | using JetBrains.ReSharper.Psi; 21 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 22 | 23 | namespace JetBrains.ReSharper.Plugins.AngularJS.Daemon.AngularJs.Stages 24 | { 25 | // NOTE: We need this because AngularJsLanguage derives from KnownLanguage, so we don't get 26 | // to take advantage of JavaScript's IdentifierHighlightingStage. This is how the JsonLanguage 27 | // works, too, but I wonder if we derive from JavaScriptLanguage then would we get this for free? 28 | [DaemonStage(StagesBefore = new[] { typeof(SmartResolverStage) })] 29 | public class IdentifierHighlightingStage : AngularJsDaemonStageBase 30 | { 31 | private readonly ResolveHighlighterRegistrar resolveHighlighterRegistrar; 32 | 33 | public IdentifierHighlightingStage(ResolveHighlighterRegistrar resolveHighlighterRegistrar) 34 | { 35 | this.resolveHighlighterRegistrar = resolveHighlighterRegistrar; 36 | } 37 | 38 | protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, 39 | DaemonProcessKind processKind, IJavaScriptFile file) 40 | { 41 | return new AngularJsIdentifierHighlighterProcess(resolveHighlighterRegistrar, process, settings, file, processKind); 42 | } 43 | 44 | public override ErrorStripeRequest NeedsErrorStripe(IPsiSourceFile sourceFile, IContextBoundSettingsStore settings) 45 | { 46 | return IsSupported(sourceFile) ? ErrorStripeRequest.STRIPE_AND_ERRORS : ErrorStripeRequest.NONE; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/Caches/AngularJsCacheItems.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using JetBrains.Util.PersistentMap; 4 | 5 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.Caches 6 | { 7 | // All the cached items in a file, directives + filters 8 | public class AngularJsCacheItems 9 | { 10 | public static readonly IUnsafeMarshaller Marshaller = 11 | new UniversalMarshaller(Read, Write); 12 | 13 | private readonly IList directives; 14 | private readonly IList filters; 15 | 16 | public AngularJsCacheItems(IList directives, IList filters) 17 | { 18 | this.directives = directives; 19 | this.filters = filters; 20 | } 21 | 22 | public IEnumerable Directives { get { return directives; } } 23 | public IEnumerable Filters { get { return filters; } } 24 | 25 | public bool IsEmpty 26 | { 27 | get { return directives.Count == 0 && filters.Count == 0; } 28 | } 29 | 30 | private static AngularJsCacheItems Read(UnsafeReader reader) 31 | { 32 | var directives = reader.ReadCollection(Directive.Read, count => new List(count)); 33 | var filters = reader.ReadCollection(Filter.Read, count => new List(count)); 34 | return new AngularJsCacheItems(directives, filters); 35 | } 36 | 37 | private static void Write(UnsafeWriter writer, AngularJsCacheItems value) 38 | { 39 | writer.Write>((w, directive) => directive.Write(w), value.Directives.ToList()); 40 | writer.Write>((w, filter) => filter.Write(w), value.Filters.ToList()); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/Caches/AngularJsCacheItemsBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.Caches 5 | { 6 | public class AngularJsCacheItemsBuilder 7 | { 8 | private readonly IDictionary directives = new Dictionary(); 9 | private readonly IDictionary filters = new Dictionary(); 10 | 11 | public AngularJsCacheItems Build() 12 | { 13 | return new AngularJsCacheItems(directives.Values.ToList(), filters.Values.ToList()); 14 | } 15 | 16 | public void Add(Directive directive) 17 | { 18 | // TODO: Should there be rules for precedence, merging? 19 | if (!directives.ContainsKey(directive.Name)) 20 | directives.Add(directive.Name, directive); 21 | } 22 | 23 | public void Add(Filter filter) 24 | { 25 | // TODO: Should there be rules for precedence, merging? 26 | if (!filters.ContainsKey(filter.Name)) 27 | filters.Add(filter.Name, filter); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/Caches/Directive.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2015 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using JetBrains.Util.PersistentMap; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.Caches 23 | { 24 | public class Directive 25 | { 26 | public const string AnyTagName = "ANY"; 27 | 28 | public readonly string OriginalName; 29 | public readonly string Name; 30 | public readonly string Restrictions; 31 | public readonly string[] Tags; 32 | public readonly int Offset; 33 | public readonly IList Parameters; 34 | 35 | public Directive(string originalName, string name, string restrictions, string[] tags, int offset, IList parameters) 36 | { 37 | OriginalName = originalName; 38 | Name = name; 39 | Restrictions = restrictions; 40 | Tags = tags; 41 | Offset = offset; 42 | Parameters = parameters; 43 | 44 | IsAttribute = restrictions.Contains('A'); 45 | IsElement = restrictions.Contains('E'); 46 | IsClass = restrictions.Contains('C'); 47 | } 48 | 49 | public bool IsAttribute { get; private set; } 50 | public bool IsElement { get; private set; } 51 | public bool IsClass { get; private set; } 52 | 53 | public bool IsForTag(string tagName) 54 | { 55 | foreach (var t in Tags) 56 | { 57 | if (t.Equals(AnyTagName, StringComparison.InvariantCultureIgnoreCase) || 58 | t.Equals(tagName, StringComparison.InvariantCultureIgnoreCase)) 59 | { 60 | return true; 61 | } 62 | } 63 | return false; 64 | } 65 | 66 | public bool IsForTagSpecific(string tagName) 67 | { 68 | return Tags.Any(t => t.Equals(tagName, StringComparison.InvariantCultureIgnoreCase)); 69 | } 70 | 71 | public bool IsForAnyTag() 72 | { 73 | if (Tags.Length == 0) 74 | return true; 75 | foreach (var t in Tags) 76 | { 77 | if (t.Equals(AnyTagName, StringComparison.InvariantCultureIgnoreCase)) 78 | return true; 79 | } 80 | return false; 81 | } 82 | 83 | public void Write(UnsafeWriter writer) 84 | { 85 | writer.Write(OriginalName); 86 | writer.Write(Name); 87 | writer.Write(Restrictions); 88 | writer.Write(UnsafeWriter.StringDelegate, Tags); 89 | writer.Write(Offset); 90 | writer.Write>((w, parameter) => parameter.Write(w), Parameters.ToList()); 91 | } 92 | 93 | public static Directive Read(UnsafeReader reader) 94 | { 95 | var originalName = reader.ReadString(); 96 | var name = reader.ReadString(); 97 | var restrictions = reader.ReadString(); 98 | var tags = reader.ReadArray(UnsafeReader.StringDelegate); 99 | var offset = reader.ReadInt(); 100 | var parameters = reader.ReadCollection(Parameter.Read, count => new List(count)); 101 | return new Directive(originalName, name, restrictions, tags, offset, parameters); 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/Caches/DirectiveUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | 3 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.Caches 4 | { 5 | public static class DirectiveUtil 6 | { 7 | private static readonly Regex NormaliseNameRegex = new Regex(@"(\B[A-Z])", RegexOptions.Compiled); 8 | 9 | public static string GetNormalisedName(string name) 10 | { 11 | return NormaliseNameRegex.Replace(name, "-$1").ToLowerInvariant(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/Caches/Filter.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2015 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Util.PersistentMap; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.Caches 20 | { 21 | public class Filter 22 | { 23 | public readonly string Name; 24 | public readonly int Offset; 25 | 26 | public Filter(string name, int offset) 27 | { 28 | Name = name; 29 | Offset = offset; 30 | } 31 | 32 | public void Write(UnsafeWriter writer) 33 | { 34 | writer.Write(Name); 35 | writer.Write(Offset); 36 | } 37 | 38 | public static Filter Read(UnsafeReader reader) 39 | { 40 | var name = reader.ReadString(); 41 | var offset = reader.ReadInt(); 42 | return new Filter(name, offset); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/Caches/Parameter.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2015 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Util.PersistentMap; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.Caches 20 | { 21 | public class Parameter 22 | { 23 | public readonly string Name; 24 | public readonly string Type; 25 | public readonly bool IsOptional; 26 | public readonly string Description; 27 | public readonly string DefaultValue; 28 | 29 | public Parameter(string name, string type, bool isOptional, string description, string defaultValue) 30 | { 31 | Name = name; 32 | Type = type; 33 | IsOptional = isOptional; 34 | Description = description; 35 | DefaultValue = defaultValue; 36 | } 37 | 38 | public static Parameter Read(UnsafeReader reader) 39 | { 40 | var name = reader.ReadString(); 41 | var type = reader.ReadString(); 42 | var isOptional = reader.ReadBoolean(); 43 | var description = reader.ReadString(); 44 | var defaultValue = reader.ReadString(); 45 | return new Parameter(name, type, isOptional, description, defaultValue); 46 | } 47 | 48 | public void Write(UnsafeWriter writer) 49 | { 50 | writer.Write(Name); 51 | writer.Write(Type); 52 | writer.Write(IsOptional); 53 | writer.Write(Description); 54 | writer.Write(DefaultValue); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Feature/Services/CodeCompletion/OverriddenAngularJsItemsRemover.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure; 3 | using JetBrains.ReSharper.Feature.Services.CodeCompletion.Infrastructure.LookupItems; 4 | using JetBrains.ReSharper.Features.Intellisense.CodeCompletion.Html; 5 | using JetBrains.ReSharper.Plugins.AngularJS.Psi.Html; 6 | using JetBrains.ReSharper.Psi; 7 | using JetBrains.ReSharper.Psi.Html; 8 | 9 | namespace JetBrains.ReSharper.Plugins.AngularJS.Feature.Services.CodeCompletion 10 | { 11 | // Removes the regular HTML declared elements that match AngularJS items, e.g. the 12 | // `a` element is implemented by 13 | [Language(typeof (HtmlLanguage))] 14 | public class OverriddenAngularJsItemsRemover : ItemsProviderOfSpecificContext 15 | { 16 | protected override void TransformItems(HtmlCodeCompletionContext context, IItemsCollector collector) 17 | { 18 | var angularItems = (from item in collector.Items 19 | let unwrappedItem = GetDeclaredElementLookupItem(item) 20 | where 21 | unwrappedItem != null && 22 | unwrappedItem.GetPreferredDeclaredElement().Element is IAngularJsDeclaredElement 23 | select item).ToJetHashSet(); 24 | var angularItemNames = angularItems.ToJetHashSet(i => i.DisplayName.Text); 25 | var toRemove = from item in collector.Items 26 | where !angularItems.Contains(item) && angularItemNames.Contains(item.DisplayName.Text) 27 | select item; 28 | 29 | foreach (var item in toRemove.ToList()) 30 | collector.Remove(item); 31 | } 32 | 33 | private static IDeclaredElementLookupItem GetDeclaredElementLookupItem(ILookupItem item) 34 | { 35 | var wrapped = item as IWrappedLookupItem; 36 | if (wrapped != null) 37 | return wrapped.Item as IDeclaredElementLookupItem; 38 | return item as IDeclaredElementLookupItem; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Hacks/LiveTemplates/Scope/DelegatingScopePoint.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Xml; 20 | using JetBrains.DocumentModel; 21 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.Scope; 22 | using JetBrains.ReSharper.Psi; 23 | using JetBrains.Util; 24 | 25 | namespace JetBrains.ReSharper.Plugins.AngularJS.Hacks.LiveTemplates.Scope 26 | { 27 | internal abstract class DelegatingScopePoint : ITemplateScopePoint 28 | { 29 | private readonly ITemplateScopePoint innerScopePoint; 30 | 31 | protected DelegatingScopePoint(ITemplateScopePoint innerScopePoint) 32 | { 33 | this.innerScopePoint = innerScopePoint; 34 | } 35 | 36 | public abstract string CalcPrefix (DocumentOffset caretOffset); 37 | 38 | public virtual bool IsSubsetOf(ITemplateScopePoint other) 39 | { 40 | return innerScopePoint.IsSubsetOf(other); 41 | } 42 | 43 | public virtual Guid GetDefaultUID() 44 | { 45 | return innerScopePoint.GetDefaultUID(); 46 | } 47 | 48 | public virtual string GetTagName() 49 | { 50 | return innerScopePoint.GetTagName(); 51 | } 52 | 53 | public virtual IEnumerable> EnumerateCustomProperties() 54 | { 55 | return innerScopePoint.EnumerateCustomProperties(); 56 | } 57 | 58 | public virtual string Prefix { get; protected set; } 59 | public virtual string PresentableShortName { get { return innerScopePoint.PresentableShortName; } } 60 | public virtual PsiLanguageType RelatedLanguage { get { return innerScopePoint.RelatedLanguage; } } 61 | 62 | public virtual Guid UID 63 | { 64 | get { return innerScopePoint.UID; } 65 | set { innerScopePoint.UID = value; } 66 | } 67 | 68 | public override string ToString() 69 | { 70 | return innerScopePoint + " (with JS prefixes)"; 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Hacks/LiveTemplates/Scope/JsAllowedPrefixes.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | namespace JetBrains.ReSharper.Plugins.AngularJS.Hacks.LiveTemplates.Scope 18 | { 19 | public static class JsAllowedPrefixes 20 | { 21 | public static readonly char[] Chars = { '_', '$' }; 22 | } 23 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Hacks/LiveTemplates/Scope/NonDefaultPrefixJavaScriptScopeProvider.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Application; 18 | using JetBrains.ReSharper.LiveTemplates.JavaScript.LiveTemplates; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Hacks.LiveTemplates.Scope 21 | { 22 | [ShellComponent] 23 | public class NonDefaultPrefixJavaScriptScopeProvider : NonDefaultPrefixWrappingScopeProvider 24 | { 25 | public NonDefaultPrefixJavaScriptScopeProvider(JavaScriptScopeProvider javaScriptScopeProvider) 26 | : base(javaScriptScopeProvider) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Hacks/LiveTemplates/Scope/NonDefaultPrefixWrappingScopeProvider.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using System; 18 | using System.Collections.Generic; 19 | using System.Linq; 20 | using System.Xml; 21 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.Context; 22 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.Scope; 23 | using JetBrains.Util; 24 | 25 | namespace JetBrains.ReSharper.Plugins.AngularJS.Hacks.LiveTemplates.Scope 26 | { 27 | // ReSharper doesn't correctly handle templates with a non-default prefix, i.e. 28 | // it only correctly handles templates that start with characters, digits or '_'. 29 | // We have templates that start with '$' 30 | // This class allows ReSharper to expand templates with the tab key. The default 31 | // JavaScript scope provider creates scopes that represent the current context in 32 | // a JS file, but doesn't provide any custom prefixes, so defaults to '_'. Here 33 | // we create the same scopes, but wrap them, and create a prefix that includes 34 | // the '$' character, so we can better match against the template shortcut 35 | public abstract class NonDefaultPrefixWrappingScopeProvider : IScopeProvider 36 | where T : IScopeProvider 37 | { 38 | private readonly T originalScopeProvider; 39 | 40 | protected NonDefaultPrefixWrappingScopeProvider(T originalScopeProvider) 41 | { 42 | this.originalScopeProvider = originalScopeProvider; 43 | } 44 | 45 | public IEnumerable ProvideScopePoints(TemplateAcceptanceContext context) 46 | { 47 | return from scopePoint in originalScopeProvider.ProvideScopePoints(context) 48 | select (ITemplateScopePoint) new ReplacingAllowedPrefixCharsScopePoint(scopePoint, context.CaretOffset, JsAllowedPrefixes.Chars); 49 | } 50 | 51 | public ITemplateScopePoint ReadFromXml(XmlElement scopeElement) 52 | { 53 | return null; 54 | } 55 | 56 | public ITemplateScopePoint CreateScope(Guid scopeGuid, string typeName, IEnumerable> customProperties) 57 | { 58 | return null; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Hacks/LiveTemplates/Scope/ReplacingAllowedPrefixCharsScopePoint.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.DocumentModel; 18 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.LiveTemplates; 19 | using JetBrains.ReSharper.Feature.Services.LiveTemplates.Scope; 20 | 21 | namespace JetBrains.ReSharper.Plugins.AngularJS.Hacks.LiveTemplates.Scope 22 | { 23 | internal class ReplacingAllowedPrefixCharsScopePoint : DelegatingScopePoint 24 | { 25 | private readonly char[] allowedPrefixChars; 26 | 27 | public ReplacingAllowedPrefixCharsScopePoint(ITemplateScopePoint innerScopePoint, DocumentOffset caretOffset, char[] allowedPrefixChars) 28 | : base(innerScopePoint) 29 | { 30 | this.allowedPrefixChars = allowedPrefixChars; 31 | 32 | Prefix = CalcPrefix(caretOffset); 33 | } 34 | 35 | 36 | public override string CalcPrefix (DocumentOffset caretOffset) 37 | { 38 | return LiveTemplatesManager.GetPrefix(caretOffset, allowedPrefixChars); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Hacks/LiveTemplates/Scope/TypeScriptFilePrefixScopeProvider.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Application; 18 | using JetBrains.ReSharper.LiveTemplates.JavaScript.LiveTemplates; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Hacks.LiveTemplates.Scope 21 | { 22 | [ShellComponent] 23 | public class TypeScriptFilePrefixScopeProvider : NonDefaultPrefixWrappingScopeProvider 24 | { 25 | public TypeScriptFilePrefixScopeProvider(TypeScriptScopeProvider typeScriptScopeProvider) 26 | : base(typeScriptScopeProvider) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2013 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using System.Reflection; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("resharper-angularjs")] 23 | [assembly: AssemblyDescription("Provides support for AngularJS development")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("JetBrains")] 26 | [assembly: AssemblyProduct("resharper-angularjs")] 27 | [assembly: AssemblyCopyright("Copyright © JetBrains, 2016")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Use a static version value so that ReSharper Build won't rebuild referencing assemblies 32 | [assembly: AssemblyVersion("1.7.0.0")] 33 | 34 | -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/AngularJsLanguage.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Annotations; 18 | using JetBrains.ReSharper.Psi; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs 21 | { 22 | // TODO: What happens if we derive from JavaScriptLanguage? 23 | // Will we automatically get a lot of JS support for free? 24 | [LanguageDefinition(Name)] 25 | public class AngularJsLanguage : KnownLanguage 26 | { 27 | public new const string Name = "AngularJS"; 28 | 29 | [CanBeNull, UsedImplicitly] 30 | public static readonly AngularJsLanguage Instance; 31 | 32 | private AngularJsLanguage() : base(Name, "AngularJS") 33 | { 34 | } 35 | 36 | protected AngularJsLanguage([NotNull] string name) 37 | : base(name) 38 | { 39 | } 40 | 41 | protected AngularJsLanguage([NotNull] string name, [NotNull] string presentableName) 42 | : base(name, presentableName) 43 | { 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/AngularJsLanguageService.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing; 18 | using JetBrains.ReSharper.Psi; 19 | using JetBrains.ReSharper.Psi.CodeStyle; 20 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Caches2; 21 | using JetBrains.ReSharper.Psi.Impl; 22 | using JetBrains.ReSharper.Psi.JavaScript.LanguageImpl; 23 | using JetBrains.ReSharper.Psi.JavaScript.Parsing; 24 | using JetBrains.ReSharper.Psi.JavaScript.Services; 25 | using JetBrains.ReSharper.Psi.Modules; 26 | using JetBrains.ReSharper.Psi.Parsing; 27 | using JetBrains.Text; 28 | 29 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs 30 | { 31 | [Language(typeof(AngularJsLanguage))] 32 | public class AngularJsLanguageService : JavaScriptBasedLanguageService 33 | { 34 | private readonly IJavaScriptCodeFormatter codeFormatter; 35 | 36 | public AngularJsLanguageService(PsiLanguageType psiLanguageType, 37 | IConstantValueService constantValueService, 38 | IJavaScriptCodeFormatter codeFormatter) 39 | : base(psiLanguageType, constantValueService) 40 | { 41 | this.codeFormatter = codeFormatter; 42 | } 43 | 44 | public override ILexerFactory GetPrimaryLexerFactory() 45 | { 46 | return new AngularJsLexerFactory(); 47 | } 48 | 49 | public override ILexer CreateFilteringLexer(ILexer lexer) 50 | { 51 | return new JavaScriptLexer(lexer); 52 | } 53 | 54 | public override IParser CreateParser(ILexer lexer, IPsiModule module, IPsiSourceFile sourceFile) 55 | { 56 | return new AngularJsParser(lexer); 57 | } 58 | 59 | public override ILanguageCacheProvider CacheProvider 60 | { 61 | // TODO: What does ILanguageCacheProvider do? 62 | get { return null; } 63 | } 64 | 65 | public override bool IsCaseSensitive 66 | { 67 | get { return true; } 68 | } 69 | 70 | public override bool SupportTypeMemberCache 71 | { 72 | // TODO: What is the type member cache? 73 | get { return false; } 74 | } 75 | 76 | public override ITypePresenter TypePresenter 77 | { 78 | get { return DefaultTypePresenter.Instance; } 79 | } 80 | 81 | public override ICodeFormatter CodeFormatter 82 | { 83 | get { return codeFormatter; } 84 | } 85 | } 86 | 87 | public class AngularJsLexerFactory : ILexerFactory 88 | { 89 | public ILexer CreateLexer(IBuffer buffer) 90 | { 91 | return new AngularJsLexerGenerated(buffer); 92 | } 93 | } 94 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/CodeStyle/AngularJsCodeFormatter.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Application.Settings; 18 | using JetBrains.DataFlow; 19 | using JetBrains.ReSharper.Psi; 20 | using JetBrains.ReSharper.Psi.JavaScript.CodeStyle; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.CodeStyle 23 | { 24 | [Language(typeof(AngularJsLanguage))] 25 | public class AngularJsCodeFormatter : JavaScriptCodeFormatterBase 26 | { 27 | public AngularJsCodeFormatter(Lifetime lifetime, PsiLanguageType language, ISettingsStore settingsStore, 28 | ISettingsOptimization settingsOptimization, 29 | JavaScriptFormattingInfoProviderBase formattingProvider, 30 | JavaScriptIndentingInfoProviderBase indentingProvider, 31 | IViewable extensions) 32 | : base(lifetime, language, settingsStore, settingsOptimization, 33 | formattingProvider, indentingProvider, extensions) 34 | { 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/CodeStyle/AngularJsFormattingInfoProvider.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.JavaScript.CodeStyle; 19 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 20 | 21 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.CodeStyle 22 | { 23 | [Language(typeof (AngularJsLanguage))] 24 | public class AngularJsFormattingInfoProvider : JavaScriptFormattingInfoProviderBase 25 | { 26 | public AngularJsFormattingInfoProvider(JavaScriptNodeTypesBase nodeTypeSets) 27 | : base(nodeTypeSets) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/CodeStyle/AngularJsIndentingInfoProvider.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.Impl.CodeStyle; 19 | using JetBrains.ReSharper.Psi.JavaScript.CodeStyle; 20 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.CodeStyle 23 | { 24 | [Language(typeof (AngularJsLanguage))] 25 | public class AngularJsIndentingInfoProvider : JavaScriptIndentingInfoProviderBase 26 | { 27 | public AngularJsIndentingInfoProvider(IFormatterDebugInfoLoggersProvider formatterDebugInfoLoggersProvider, 28 | JavaScriptNodeTypesBase nodeTypeSets) 29 | : base(formatterDebugInfoLoggersProvider, nodeTypeSets) 30 | { 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/AngularJsParser.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.DataFlow; 18 | using JetBrains.ReSharper.Psi; 19 | using JetBrains.ReSharper.Psi.JavaScript.Parsing; 20 | using JetBrains.ReSharper.Psi.Parsing; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing 23 | { 24 | public class AngularJsParser : JavaScriptQuickParser 25 | { 26 | public AngularJsParser(ILexer lexer) 27 | : base(lexer) 28 | { 29 | } 30 | 31 | protected override PsiLanguageType Language 32 | { 33 | get { return AngularJsLanguage.Instance; } 34 | } 35 | 36 | protected override JavaScriptTreeBuilder CreateTreeBuilder(Lifetime lifetime) 37 | { 38 | return new AngularJsTreeBuilder(myLexer, lifetime); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/AngularJsTokenType.Tokens.xml: -------------------------------------------------------------------------------- 1 |  49 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/AngularJsTokenType.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Annotations; 18 | using JetBrains.ReSharper.Psi.JavaScript.Parsing; 19 | 20 | // TODO: Move namespace to JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJS.Parsing 21 | // A bug in the TokenGenerator tool means that the namespace of this class 22 | // has to start with JetBrains.ReSharper.Psi or it fails to compile (it uses 23 | // JetBrains.ReSharper.Psi.TreeOffset without the appropriate using statement) 24 | // See: http://youtrack.jetbrains.com/issue/RSRP-411978 25 | // ReSharper disable once CheckNamespace 26 | namespace JetBrains.ReSharper.Psi.AngularJs.Parsing 27 | { 28 | // Here is where we would define the KeywordTokenNodeType, FixedTokenElement, 29 | // and FixedTokenNodeType base classes. But we're piggy-backing on the JS 30 | // parser, so we can use those definitions, by inheriting from JavaScriptTokenType 31 | [UsedImplicitly] 32 | public partial class AngularJsTokenType : JavaScriptTokenType 33 | { 34 | } 35 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/AngularJsTokenType.generated.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Generated by TokenGenerator 4 | // Changes to this file may cause incorrect behavior and will be lost if 5 | // the code is regenerated. 6 | // 7 | //------------------------------------------------------------------------------ 8 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; 9 | using JetBrains.Text; 10 | using JetBrains.ReSharper.Psi; 11 | using JetBrains.ReSharper.Psi.Parsing; 12 | 13 | namespace JetBrains.ReSharper.Psi.AngularJs.Parsing 14 | { 15 | public partial class AngularJsTokenType 16 | { 17 | #region UNDEFINED_KEYWORD 18 | private class UndefinedKeywordNodeType : KeywordTokenNodeType 19 | { 20 | public UndefinedKeywordNodeType(int index): base ("UNDEFINED_KEYWORD", "undefined", index) { } 21 | public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset) 22 | { 23 | return new UndefinedKeywordTokenElement(this); 24 | } 25 | } 26 | private class UndefinedKeywordTokenElement : FixedTokenElement 27 | { 28 | public UndefinedKeywordTokenElement(UndefinedKeywordNodeType tokenNodeType) : base(tokenNodeType) { } 29 | } 30 | public static readonly TokenNodeType UNDEFINED_KEYWORD = new UndefinedKeywordNodeType(7000); 31 | #endregion 32 | #region TRACK_BY_KEYWORD 33 | private class TrackByKeywordNodeType : KeywordTokenNodeType 34 | { 35 | public TrackByKeywordNodeType(int index): base ("TRACK_BY_KEYWORD", "track by", index) { } 36 | public override LeafElementBase Create(IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset) 37 | { 38 | return new TrackByKeywordTokenElement(this); 39 | } 40 | } 41 | private class TrackByKeywordTokenElement : FixedTokenElement 42 | { 43 | public TrackByKeywordTokenElement(TrackByKeywordNodeType tokenNodeType) : base(tokenNodeType) { } 44 | } 45 | public static readonly TokenNodeType TRACK_BY_KEYWORD = new TrackByKeywordNodeType(7001); 46 | #endregion 47 | 48 | 49 | private const int LAST_GENERATED_TOKEN_TYPE_INDEX = 7002; } 50 | } 51 | -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/AngularJsElementType.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; 18 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 21 | { 22 | // ReSharper disable InconsistentNaming 23 | public abstract class AngularJsElementType 24 | { 25 | #region REPEAT_EXPRESSION 26 | 27 | public static readonly CompositeNodeType REPEAT_EXPRESSION = REPEAT_EXPRESSION_INTERNAL.INSTANCE; 28 | 29 | private class REPEAT_EXPRESSION_INTERNAL : JavaScriptCompositeNodeType 30 | { 31 | public static readonly REPEAT_EXPRESSION_INTERNAL INSTANCE = new REPEAT_EXPRESSION_INTERNAL(20000); 32 | 33 | private REPEAT_EXPRESSION_INTERNAL(int index) 34 | : base("REPEAT_EXPRESSION", index) 35 | { 36 | } 37 | 38 | public override CompositeElement Create() 39 | { 40 | return new RepeatExpression(); 41 | } 42 | } 43 | 44 | #endregion 45 | 46 | #region FILTER_EXPRESSION 47 | 48 | public static readonly CompositeNodeType FILTER_EXPRESSION = FILTER_EXPRESSION_INTERNAL.INSTANCE; 49 | 50 | private class FILTER_EXPRESSION_INTERNAL : JavaScriptCompositeNodeType 51 | { 52 | public static readonly FILTER_EXPRESSION_INTERNAL INSTANCE = new FILTER_EXPRESSION_INTERNAL(20001); 53 | 54 | private FILTER_EXPRESSION_INTERNAL(int index) 55 | : base("FILTER_EXPRESSION", index) 56 | { 57 | } 58 | 59 | public override CompositeElement Create() 60 | { 61 | return new FilterExpression(); 62 | } 63 | } 64 | 65 | #endregion 66 | 67 | #region FILTER_ARGUMENT_LIST 68 | 69 | public static readonly CompositeNodeType FILTER_ARGUMENT_LIST = FILTER_ARGUMENT_LIST_INTERNAL.INSTANCE; 70 | 71 | private class FILTER_ARGUMENT_LIST_INTERNAL : JavaScriptCompositeNodeType 72 | { 73 | public static readonly FILTER_ARGUMENT_LIST_INTERNAL INSTANCE = new FILTER_ARGUMENT_LIST_INTERNAL(20002); 74 | 75 | private FILTER_ARGUMENT_LIST_INTERNAL(int index) 76 | : base("FILTER_ARGUMENT_LIST", index) 77 | { 78 | } 79 | 80 | public override CompositeElement Create() 81 | { 82 | return new FilterArgumentList(); 83 | } 84 | } 85 | 86 | #endregion 87 | } 88 | // ReSharper restore InconsistentNaming 89 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/FilterArgumentList.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; 18 | using JetBrains.ReSharper.Psi.JavaScript.Impl.Tree; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 21 | { 22 | internal class FilterArgumentList : JavaScriptCompositeElement 23 | { 24 | public override NodeType NodeType 25 | { 26 | get { return AngularJsElementType.FILTER_ARGUMENT_LIST; } 27 | } 28 | 29 | // TODO: Make the children available via properties 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/FilterExpression.8.2.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.JavaScript.Resolve; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 20 | { 21 | internal partial class FilterExpression 22 | { 23 | // TODO: Make the children available via properties 24 | 25 | public override IJavaScriptType GetJsType(IJsLocalElementResolver context) 26 | { 27 | return JavaScriptType.Empty; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/FilterExpression.9.0.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.JavaScript.Resolve; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 20 | { 21 | internal partial class FilterExpression 22 | { 23 | // TODO: Make the children available via properties 24 | public override IJsUnresolvedType GetJsType(IJsLocalElementResolver context) 25 | { 26 | return JavaScriptType.Empty; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/FilterExpression.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; 18 | using JetBrains.ReSharper.Psi.JavaScript.Impl.Tree; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 21 | { 22 | internal partial class FilterExpression : JavaScriptExpressionBase 23 | { 24 | public override NodeType NodeType 25 | { 26 | get { return AngularJsElementType.FILTER_EXPRESSION; } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/RepeatExpression.8.2.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.JavaScript.Resolve; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 20 | { 21 | internal partial class RepeatExpression 22 | { 23 | 24 | // TODO: Make the children available via properties 25 | 26 | public override IJavaScriptType GetJsType(IJsLocalElementResolver context) 27 | { 28 | return JavaScriptType.Empty; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/RepeatExpression.9.0.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; 18 | using JetBrains.ReSharper.Psi.JavaScript.Impl.Tree; 19 | using JetBrains.ReSharper.Psi.JavaScript.Resolve; 20 | 21 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 22 | { 23 | internal partial class RepeatExpression 24 | { 25 | // TODO: Make the children available via properties 26 | 27 | public override IJsUnresolvedType GetJsType(IJsLocalElementResolver context) 28 | { 29 | return JavaScriptType.Empty; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Parsing/Tree/RepeatExpression.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; 18 | using JetBrains.ReSharper.Psi.JavaScript.Impl.Tree; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Parsing.Tree 21 | { 22 | internal partial class RepeatExpression : JavaScriptExpressionBase 23 | { 24 | public override NodeType NodeType 25 | { 26 | get { return AngularJsElementType.REPEAT_EXPRESSION; } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/References/AngularJsFileLateBoundReference.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.Html.Impl.References; 19 | using JetBrains.ReSharper.Psi.Resolve; 20 | using JetBrains.ReSharper.Psi.Tree; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.References 23 | { 24 | public sealed class AngularJsFileLateBoundReference : HtmlFileLateBoundReference 25 | where TOwner : ITreeNode 26 | where TToken : class, ITreeNode 27 | { 28 | public AngularJsFileLateBoundReference(TOwner owner, IQualifier qualifier, TToken token, TreeTextRange rangeWithin) 29 | : base(owner, qualifier, token, rangeWithin) 30 | { 31 | } 32 | 33 | protected override ISymbolFilter[] GetCompletionFilters() 34 | { 35 | var filters = base.GetCompletionFilters(); 36 | var newFilters = new ISymbolFilter[filters.Length+1]; 37 | filters.CopyTo(newFilters, 0); 38 | newFilters[filters.Length] = new IgnoreRootPathFilter(); 39 | return newFilters; 40 | } 41 | 42 | public override bool? IsServerSideWebRoot() 43 | { 44 | return null; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/References/AngularJsFolderLateBoundReference.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.Html.Impl.References; 19 | using JetBrains.ReSharper.Psi.Resolve; 20 | using JetBrains.ReSharper.Psi.Tree; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.References 23 | { 24 | public class AngularJsFolderLateBoundReference : HtmlFolderLateBoundReference 25 | where TOwner : ITreeNode 26 | where TToken : class, ITreeNode 27 | { 28 | public AngularJsFolderLateBoundReference(TOwner owner, IQualifier qualifier, TToken token, TreeTextRange rangeWithin) 29 | : base(owner, qualifier, token, rangeWithin) 30 | { 31 | } 32 | 33 | protected override ISymbolFilter[] GetCompletionFilters() 34 | { 35 | var filters = base.GetCompletionFilters(); 36 | var newFilters = new ISymbolFilter[filters.Length + 1]; 37 | filters.CopyTo(newFilters, 0); 38 | newFilters[filters.Length] = new IgnoreRootPathFilter(); 39 | return newFilters; 40 | } 41 | 42 | public override bool? IsServerSideWebRoot() 43 | { 44 | return null; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/References/AngularJsReferenceFactoryBase.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 19 | using JetBrains.ReSharper.Psi.Resolve; 20 | using JetBrains.ReSharper.Psi.Tree; 21 | 22 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.References 23 | { 24 | public abstract class AngularJsReferenceFactoryBase : StatelessReferenceProviderFactoryBase 25 | { 26 | public override bool IsApplicableToFile(IPsiSourceFile sourceFile, IFile file) 27 | { 28 | // TODO: Should we have an IAngularJsFile? 29 | // There isn't an IJsonFile, but there is ITsFile 30 | return file is IJavaScriptFile && file.Language.Is(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/References/IgnoreRootPathFilter.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.Impl; 19 | using JetBrains.ReSharper.Psi.Resolve; 20 | 21 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.References 22 | { 23 | public class IgnoreRootPathFilter : SimpleSymbolFilter 24 | { 25 | public override bool Accepts(IDeclaredElement declaredElement, ISubstitution substitution) 26 | { 27 | return declaredElement.ShortName != PathDeclaredElement.ROOT_NAME; 28 | } 29 | 30 | public override ResolveErrorType ErrorType 31 | { 32 | get { return FileResolveErrorType.PATH_IGNORED; } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Tree/AngularJsFileData.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Util; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Tree 20 | { 21 | public static class AngularJsFileData 22 | { 23 | public static readonly Key OriginalAttributeType = new Key("AngularJs:OriginalAttributeType"); 24 | } 25 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/AngularJs/Tree/AngularJsNodeTypes.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi; 18 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.AngularJs.Tree 21 | { 22 | // TODO: AngularJs specific node types 23 | [Language(typeof(AngularJsLanguage))] 24 | public class AngularJsNodeTypes : JavaScriptNodeTypesBase 25 | { 26 | } 27 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/Html/AngularJsDeclaredElementIconProvider.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.ReSharper.Plugins.AngularJS.Resources; 2 | using JetBrains.ReSharper.Psi; 3 | using JetBrains.UI.Icons; 4 | 5 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.Html 6 | { 7 | [DeclaredElementIconProvider] 8 | public class AngularJsDeclaredElementIconProvider : IDeclaredElementIconProvider 9 | { 10 | public IconId GetImageId(IDeclaredElement declaredElement, PsiLanguageType languageType, out bool canApplyExtensions) 11 | { 12 | canApplyExtensions = false; 13 | if (declaredElement is IAngularJsDeclaredElement) 14 | return LogoThemedIcons.Angularjs.Id; 15 | return null; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/Html/AngularJsHtmlAttributeDeclaredElement.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml; 3 | using JetBrains.ReSharper.Psi; 4 | using JetBrains.ReSharper.Psi.Html; 5 | using JetBrains.ReSharper.Psi.Html.Html; 6 | using JetBrains.ReSharper.Psi.Html.Impl.Html; 7 | using JetBrains.ReSharper.Psi.Html.Impl.TagPrefixes; 8 | using JetBrains.ReSharper.Psi.Tree; 9 | using JetBrains.ReSharper.Psi.Web; 10 | using JetBrains.Util; 11 | using JetBrains.Util.DataStructures; 12 | 13 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.Html 14 | { 15 | public class AngularJsHtmlAttributeDeclaredElement : IHtmlAttributeDeclaredElement, IAngularJsDeclaredElement 16 | { 17 | private readonly IPsiServices psiServices; 18 | 19 | public AngularJsHtmlAttributeDeclaredElement(IPsiServices psiServices, string shortName, 20 | IHtmlAttributeValueType type, IHtmlTagDeclaredElement tag) 21 | { 22 | ShortName = shortName; 23 | ValueType = type; 24 | Tag = tag; 25 | this.psiServices = psiServices; 26 | } 27 | 28 | public IPsiServices GetPsiServices() 29 | { 30 | return psiServices; 31 | } 32 | 33 | public IList GetDeclarations() 34 | { 35 | // TODO: Return proper declarations 36 | // Can this work? Declaration might be a comment node!? 37 | return EmptyList.InstanceList; 38 | } 39 | 40 | public IList GetDeclarationsIn(IPsiSourceFile sourceFile) 41 | { 42 | // TODO: Return proper declarations 43 | // Can this work? Declaration might be a comment node!? 44 | return EmptyList.InstanceList; 45 | } 46 | 47 | public DeclaredElementType GetElementType() 48 | { 49 | return HtmlDeclaredElementType.HTML_ATTRIBUTE; 50 | } 51 | 52 | public XmlNode GetXMLDoc(bool inherit) 53 | { 54 | return null; 55 | } 56 | 57 | public XmlNode GetXMLDescriptionSummary(bool inherit) 58 | { 59 | return null; 60 | } 61 | 62 | public bool IsValid() 63 | { 64 | return true; 65 | } 66 | 67 | public bool IsSynthetic() 68 | { 69 | return false; 70 | } 71 | 72 | public HybridCollection GetSourceFiles() 73 | { 74 | // TODO: Should be able to return source file 75 | return HybridCollection.Empty; 76 | } 77 | 78 | public bool HasDeclarationsIn(IPsiSourceFile sourceFile) 79 | { 80 | // TODO: Should be able to return source file 81 | return false; 82 | } 83 | 84 | public string ShortName { get; private set; } 85 | public bool CaseSensitiveName { get { return false; } } 86 | public PsiLanguageType PresentationLanguage { get { return HtmlLanguage.Instance; } } 87 | public AspNetVersion? SupportedVersion { get { return null; } } 88 | public bool Obsolete { get { return false; } } 89 | public bool NonStandard { get { return false; } } 90 | public AttributeValueRequirement ValueRequirement { get { return AttributeValueRequirement.Required; } } 91 | public IHtmlAttributeValueType ValueType { get; private set; } 92 | public IHtmlTagDeclaredElement Tag { get; private set; } 93 | 94 | // Canonical DOM name, for e.g. HTML in JSX, which needs to be case sensitive onClick vs onclick 95 | public string DomName { get { return null; } } 96 | 97 | public bool CanBeRenamed { get; private set; } 98 | 99 | public override bool Equals(object obj) 100 | { 101 | if (ReferenceEquals(this, obj)) return true; 102 | 103 | var attribute = obj as AngularJsHtmlAttributeDeclaredElement; 104 | if (attribute == null) return false; 105 | 106 | return attribute.ShortName == ShortName; 107 | } 108 | 109 | public override int GetHashCode() 110 | { 111 | return ShortName.GetHashCode(); 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Psi/Html/IAngularJsDeclaredElement.cs: -------------------------------------------------------------------------------- 1 | namespace JetBrains.ReSharper.Plugins.AngularJS.Psi.Html 2 | { 3 | public interface IAngularJsDeclaredElement 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/Resources/Logo/ThemedIcons.Logo.Generated.Xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/resharper-angularjs/Resources/Logo/angularjs-logo.xaml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/resharper-angularjs/TreeNodeExtensions.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2015 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.ReSharper.Psi.JavaScript.Tree; 18 | using JetBrains.ReSharper.Psi.Tree; 19 | 20 | namespace JetBrains.ReSharper.Plugins.AngularJS 21 | { 22 | public static class TreeNodeExtensions 23 | { 24 | public static string GetStringLiteralValue(this ITreeNode treeNode) 25 | { 26 | var literalExpression = treeNode as IJavaScriptLiteralExpression; 27 | if (literalExpression != null && literalExpression.IsStringLiteral()) 28 | return literalExpression.GetStringValue(); 29 | 30 | return null; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/ZoneMarker.cs: -------------------------------------------------------------------------------- 1 | #region license 2 | // Copyright 2014 JetBrains s.r.o. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | #endregion 16 | 17 | using JetBrains.Application.BuildScript.Application.Zones; 18 | 19 | namespace JetBrains.ReSharper.Plugins.AngularJS 20 | { 21 | // TODO: Require appropriate zones 22 | [ZoneMarker] 23 | public class ZoneMarker 24 | { 25 | } 26 | } -------------------------------------------------------------------------------- /src/resharper-angularjs/resharper-angularjs.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net45 5 | false 6 | false 7 | JetBrains.ReSharper.Plugins.AngularJS 8 | JetBrains.ReSharper.Plugins.AngularJS 9 | 10 | 11 | 12 | TRACE;DEBUG;NET45;JET_MODE_ASSERT 13 | x86 14 | 15 | 16 | 17 | x86 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Color 31 | False 32 | MSBuild:Compile 33 | Designer 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Always 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/resharper-angularjs/resharper-angularjs.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | CSharp50 -------------------------------------------------------------------------------- /test/data/Caches/CacheDefaultAngularFilters12.gold: -------------------------------------------------------------------------------- 1 | currency 539078 2 | date 548501 3 | filter 530812 4 | json 555092 5 | limitTo 556403 6 | lowercase 556021 7 | number 541361 8 | orderBy 560713 9 | uppercase 556213 10 | -------------------------------------------------------------------------------- /test/data/Caches/CacheDefaultAngularFilters13.gold: -------------------------------------------------------------------------------- 1 | currency 616128 2 | date 627555 3 | filter 607202 4 | json 634834 5 | limitTo 636495 6 | lowercase 636113 7 | number 619048 8 | orderBy 641409 9 | uppercase 636305 10 | -------------------------------------------------------------------------------- /test/data/Caches/CacheDefaultAngularFilters14.gold: -------------------------------------------------------------------------------- 1 | currency 671157 2 | date 682880 3 | filter 661133 4 | json 690460 5 | limitTo 692121 6 | lowercase 691739 7 | number 674097 8 | orderBy 697708 9 | uppercase 691931 10 | -------------------------------------------------------------------------------- /test/data/Caches/DirectiveFromSourceWithInjectedFunction.gold: -------------------------------------------------------------------------------- 1 | Directives: 1 2 | sample sample A <> 32 3 | -------------------------------------------------------------------------------- /test/data/Caches/DirectiveFromSourceWithInjectedFunction.js: -------------------------------------------------------------------------------- 1 | angular.module('foo').directive('sample', ['$foo', function factory($foo) { 2 | 3 | return { 4 | restrict: 'A' 5 | }; 6 | }]); 7 | -------------------------------------------------------------------------------- /test/data/Caches/DirectiveFromSourceWithRestrictProperty.gold: -------------------------------------------------------------------------------- 1 | Directives: 1 2 | sample sample A <> 32 3 | -------------------------------------------------------------------------------- /test/data/Caches/DirectiveFromSourceWithRestrictProperty.js: -------------------------------------------------------------------------------- 1 | angular.module('foo').directive('sample', function factory() { 2 | 3 | return { 4 | restrict: 'A' 5 | }; 6 | }); 7 | -------------------------------------------------------------------------------- /test/data/Caches/SimpleDirectiveFromSource.gold: -------------------------------------------------------------------------------- 1 | Directives: 1 2 | sample sample AE <> 32 3 | -------------------------------------------------------------------------------- /test/data/Caches/SimpleDirectiveFromSource.js: -------------------------------------------------------------------------------- 1 | angular.module('foo').directive('sample', function sample() { 2 | 3 | return function(scope, elem, attrs) { 4 | // No object literal, use defaults 5 | }; 6 | }); 7 | -------------------------------------------------------------------------------- /test/data/CodeCompletion/Double/List/ShowAllItemsOnDoubleCompletionWithNoPrefix.html: -------------------------------------------------------------------------------- 1 | 2 |