Commit Graph

54 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran f4e9ddad22 Link syntax tree Span nodes 2017-10-10 13:07:27 -07:00
Ajay Bhargav Baaskaran bd8e9ecc31 Added RazorParserFeatureFlags and added support for minimized bool tag
helper bound attributes
 - Fixes #1678, #431
2017-09-29 16:02:09 -07:00
Ajay Bhargav Baaskaran aa445ee9b4 Add error for using single quotes in add/remove taghelper directive 2017-09-07 11:29:33 -07:00
Ajay Bhargav Baaskaran 4b68a48f1d Fix: Broken intellisense for extensible directives 2017-08-29 14:47:52 -07:00
Ajay Bhargav Baaskaran b12683a35d Mark trailing whitespace after type name in directives as markup 2017-08-29 12:48:44 -07:00
Ajay Bhargav Baaskaran f3d121cacf Mark whitespace between tag helper directive and its value as Markup 2017-08-28 21:42:37 -07:00
Ajay Bhargav Baaskaran fa6fde2b20 Moved TagHelper directive validation and parsing from TagHelperBinder to
CSharpCodeParser
2017-08-23 17:14:41 -07:00
Nate McMaster 0c3fff3137 Upgrade to xunit 2.3.0-beta4 (#1640)
Includes a few changes required by xunit.analyzers, such as removing unused theory parameters.
2017-08-23 12:56:31 -07:00
Ajay Bhargav Baaskaran 45732a5dd3 Fix: Nested tag helpers do not work when tag helper prefix is set 2017-08-17 15:26:10 -07:00
Ajay Bhargav Baaskaran 8d2a9e5929 Support tuples for type directive tokens 2017-08-14 12:43:41 -07:00
Ajay Bhargav Baaskaran 364fc1a55d Allow nullable types with generic arguments in directives 2017-08-10 11:47:43 -07:00
Ryan Nowak 8bbfecb0da Merge branch 'rel/2.0.0' into dev 2017-07-17 13:17:03 -07:00
Ryan Nowak 59d3fb433b Fix #1555
Revert validation that file-scoped directives appear before HTML or
code.
2017-07-17 11:24:58 -07:00
N. Taylor Mullen f8d43853f8 Re-introduce RazorEditorParser.
- Revived `RazorEditorParser`.
- Made `PartialParseResult` internal and renamed it to `PartialParseResultInternal`. This fell in line with other syntax tree types.
- Moved the `RazorEditorParser` implementation away from `TextChange` and `ITextBuffer`. Instead it now relies on `SourceChange` and the VS contract `ITextSnapshot`.
- Added `RazorEditorParserTest` to ensure the changes in implementation did not impact previous functionality.
- Removed some obvious tests that unnecessarily re-tested behavior that was already verified.
- Updated tests.
- Moved several Language.Test types to the common test project so they could be reused.

#1259
2017-07-12 17:01:16 -07:00
N. Taylor Mullen b68290ddb7 Make `RazorParserOptions` creation more like RazorEngine
- Removed verbose `Create` methods in favor of the `RazorParserOptionsBuilder`. This is similar to how the `RazorEngine` functions.
- Added a `CreateDesignTime` method.
- Updated existing tests to use new Create syntax.

#1510
2017-07-06 14:33:33 -07:00
Ajay Bhargav Baaskaran 9c031e6fb5 Moved all TagHelperDescriptor related builders to have getter setter
instead of methods

More polish to the tag helper descriptor builders.
- Expose underlying builders as getter only list
- Added AsDictionary() extension method to BoundAttributeDescriptorBuilder
- Expose diagnostics as RazorDiagnosticCollection
- Got rid of Require** prefix in TagMatchingRuleBuilder
- Workaround issue aspnet/Razor#1492 by copying the test descriptor
  extensions
2017-06-30 14:08:05 -07:00
Ryan Nowak 853b458893 This is a different take on Taylor's builders.
This makes it possible to use another 'kind' of tag helpers, which isn't
possible today.

This also further decouples the tag helper api surface from the default
implementation.

VCTH now have their own 'kind'.

Also improved generation of display names and error messages where it
was coupled to the type name.
2017-06-28 17:37:52 -07:00
N. Taylor Mullen 05cc4123a7 Add duplicate directive error for th prefix.
- Regenerated diagnostics for integration tests.
- Added a duplicate directive unit test.
- Added a new RazorDiagnostic entry in the factory.

#942
2017-06-28 16:12:02 -07:00
N. Taylor Mullen c2c95ec175 Add file scoped multiple occurring extensible directives.
- Updated existing singly occurring tests that verified that the directives must occur prior to any content to be theories that tested the joint "file scoped" behavior of the usage.
- Added tests that validate `FileScopedMultipleOccurring` can have duplicate directives without erroring.

#1377
2017-06-26 20:29:06 -07:00
N. Taylor Mullen 7a04e35da5 Update built-in directives to use DirectiveUsage.
- Updated integration code gen and IR bits to reflect new directive usage.
- Updated existing unit tests that happened to test directives in code blocks to now test what happens when they exist at the document level. Being inside of a code block is now invalid and we have separate tests for that scenario.

#1376
2017-06-22 11:42:37 -07:00
N. Taylor Mullen 2453689804 Add file scoped extensible directives.
- Added `DirectiveUsage` to enable extensible directive authors to indicate how their directives should be used. Currently support `Unrestricted` (how section directives have always worked) and a file scoped singly occurring directive.
- Added directive parsing tests.
- Removed no longer used `BlockKindInternal` items.

#1376
2017-06-22 11:42:37 -07:00
Ryan Nowak a40ca857c5 Rename HtmlAttributeValueStyle>AttributeStructure 2017-06-21 18:56:37 -07:00
Ajay Bhargav Baaskaran 4811807329 Moved CSharpCodeWriter out of legacy 2017-06-21 15:05:46 -07:00
N. Taylor Mullen 132c8c7a7e Implement consistent error story for directives.
- Added error case that enforces whitespace in between directive tokens.
- Upon encountering invalid directive tokens/states we bail out of parsing and log an appropriate error.
- Raised directive parse errors to the IR layer. This is slightly hacky given the parsers limitations; we swap out the error sink temporarily to capture all directive parser errors and then shove the errors collected onto the directives chunk generator.
- Added a `MalformedDiretiveIRNode` and corresponding pass to represent directives that are in an invalid state. Chose to not take the path of using the default `DirectiveIRNode.Diagnostics` member to enable users who are extending directives to only ever have to work with "valid" directives. If they want to work with malformed directives they can search the IR document for their malformed counterpart and handle it separately.
- Updated existing test expectations
- Removed some existing tests that were no longer valid (we don't call into user code if a directive is malformed).

#1173
2017-06-19 21:14:06 -07:00
Ryan Nowak 22d52f2a3c Split the functions/section/inherits directives 2017-06-13 18:05:34 -07:00
Ajay Bhargav Baaskaran 27b73d737b Set correct value style for literal tag helper bound attributes 2017-06-09 12:05:27 -07:00
Ajay Bhargav Baaskaran 8bba757703 Don't ignore whitespace at the start of '<text>' tag 2017-06-08 11:56:24 -07:00
Ryan Nowak 95c5049dd0 Add DisplayName and Description for directives
Renamed Name -> Directive so that it doesn't overlap with DisplayName.
2017-06-07 13:37:34 -07:00
Ajay Bhargav Baaskaran eb2e090e2a Fix failing test 2017-06-01 17:24:24 -07:00
Ajay Bhargav Baaskaran eab052d9e0 Merge branch 'rel/15.3' into rel/2.0.0-preview2 2017-06-01 17:15:07 -07:00
Ajay Bhargav Baaskaran 4c1795fc79 [Fixes #1394] Fix unexpected indentation when autoformatting in VS 2017-06-01 15:57:52 -07:00
N. Taylor Mullen 4fde9ca07d Merge branch 'rel/15.3' into rel/2.0.0-preview2
# Conflicts:
#	src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpAutoCompleteTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpDirectivesTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSectionTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpSpecialBlockTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlToCodeSwitchTest.cs
2017-06-01 15:32:47 -07:00
N. Taylor Mullen 1f32a8322e Make invalid namespace tokens support IntelliSense.
- Added a `DirectiveTokenEditHandler` to enable IntelliSense for invalid namespace tokens.
- Added tests to verify new `DirectiveTokenEditHandler`.
- Updated test expectations for `DirectiveTokenEditHandler`.

#1393
2017-06-01 12:04:20 -07:00
N. Taylor Mullen 2e8c154fcb Make namespace tokens tolerant to EOF and invalid states.
- Updated our `QualifiedIdentifier` to properly parse invalid namespaces. This is more consistent with how the rest of the system works; we consume tokens until we determine if we're in an invalid or valid state. If invalid, we log an error and put back all invalid tokens for the parser to treat as non-directive tokens.
- Added unit tests to validate our extensible directive system can handle malformed namespace tokens at EOF and inline.
- Added a code gen test for Razor.Extensions to prove we've fixed the underlying issue for our `@namespace` directive that crashed VS.

#1393
2017-06-01 12:04:20 -07:00
N. Taylor Mullen 0688cd3ef7 Log errors if directives do not start at beginning of line.
- Updated tests to validate expectations.
- Added two additional tests to validate extensible directives and built-in directives get start at line verification.
2017-05-30 15:19:46 -07:00
N. Taylor Mullen 3b53f04518 Change ParserContext to take a RazorSourceDocument.
- This moves ParserContext closer to operating on a RazorSourceDocument and exposes it at the parsing layer.
- Was not able to replace the `ITextDocument` property on `ParserContext` due to its current wiring. Our tokenizers rely on a single reader that iterates over the document and take turns tokenizing characters from that reader. The reader that the tokenizers pull from is also highly coupled with the parsers implementations; they end up moving the readers pointer frequently.
2017-05-30 15:18:19 -07:00
N. Taylor Mullen 2eb443acb6 Merge branch 'rel/15.3' into dev
# Conflicts:
#	src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs
#	src/Microsoft.AspNetCore.Razor.Language/TagHelperDescriptorBuilder.cs
#	src/Microsoft.CodeAnalysis.Razor/ViewComponentTagHelperDescriptorFactory.cs
#	test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpDirectivesTest.cs
#	test/Microsoft.CodeAnalysis.Razor.Test/ViewComponentTagHelperDescriptorFactoryTest.cs
2017-05-19 11:23:00 -07:00
N. Taylor Mullen 03f3975360 Allow directive string tokens to be colorized.
- Without a directive string token having a `SpanKind.Code` it cannot have any sort of C# coloring associated with it.
- Updated tests to reflect new `SpanKind` expectations.

#1269
2017-05-18 10:36:54 -07:00
Ryan Nowak e391ac7a3c Split options into ParserOptions and CodeGenerationOptions 2017-05-18 10:22:39 -07:00
Ryan Nowak 5a1090f324 Api Cleanup for language services
Created internal + public versions of
- BlockKind
- SpanKind
- AcceptedCharacters

That way these types are only exposed through the VS apis and not
through the runtime API surface.

Also deleted RazorEditorParser. Yep. It's going to take significant work
to just port it to the language services assembly. Let's reevaluate this
when we get closer to the next foundational update.
2017-05-17 22:09:01 -07:00
Ajay Bhargav Baaskaran 7bd13061b5 Set the chunk generator of non-string tag helper attributes to ExpressionChunkGenerator 2017-05-17 11:17:01 -07:00
Ryan Nowak 2167e4151e Fix #1311 add a base class for features 2017-05-12 21:15:59 -07:00
Nate McMaster 682d630fa2 Upgrade test framework versions and fix issues with tests 2017-05-12 15:41:49 -07:00
Ryan Nowak b17e506ce8 Some API cleanup around directivest 2017-05-12 13:27:28 -07:00
Ryan Nowak d3e37f20ce Add some new IR nodes
This adds the basics of a few new node types. I'll do a follow up to start
using these so we can eliminate some misuse of the statement node.
2017-05-11 14:52:31 -07:00
N. Taylor Mullen 774aebaa01 Rename TagHelperDescriptorProvider => TagHelperBinder.
- Moved the type out of the Legacy namespace.
- Renamed the types method to `GetBinding` since `TagHelper` is now inferred.
- Updated test names to reflect new method/class name.
- Updated product code variables to reflect new naming (provider => binder).

#1289
2017-05-08 16:59:53 -07:00
Ryan Nowak e15d1be616 Introduce SourceChange in place of TextChange
This is the first step on the journey to replacing RazorEditorParser. We
can't just get rid of this because VS is using it today.
2017-05-03 17:53:08 -07:00
N. Taylor Mullen 49e3533bc3 Add test to validate unbalanced triple dash comment inside razor block.
#302
2017-04-27 12:03:59 -07:00
N. Taylor Mullen 344862fbc3 Change string token parsing to not flow errored tokens.
- Found that our extensible directive string parsing system wasn't consistent with the rest of the extensible directive tokens. Basically, if there were malformed string tokens we'd consume them and pass them along to extensible directive passes. This was a big no-no because it means extensible directive passes weren't able to rely on tokens being passed to them being well-formed.
- Fixed up existing extensible directive tests that relied on output of string tokens.

#1247
2017-04-26 16:38:58 -07:00
Ajay Bhargav Baaskaran cd486226d6 [Fixes #1195] Add a way to parse just until the first directive 2017-04-13 15:02:17 -07:00