Commit Graph

28 Commits

Author SHA1 Message Date
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
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 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 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
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 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 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 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
Ryan Nowak b17e506ce8 Some API cleanup around directivest 2017-05-12 13:27:28 -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
Ryan Nowak e5cac9fb7f Implement @namespace
This change adds support for @namespace, and introduces a set of
changes that are needed to support @namespace in the parser.

@namespace and @class have always been treated as reserved words by Razor,
with the intent that someday they would be allowed as directives.

This changes makes that possible.

You will still get an error about @namespace being a reserved word if you
don't have the directive.
2017-04-11 12:46:02 -07:00
N. Taylor Mullen 0618bae3bd Rename Microsoft.AspNetCore.Razor.Evolution => Microsoft.AspNetCore.Razor.Language.
- Also updated corresponding test project to go from Evolution => Language.
- Regenerated test files to reflect new file paths.

#1169
2017-04-10 10:20:04 -07:00