Commit Graph

1307 Commits

Author SHA1 Message Date
Ryan Nowak 13e13d7632 Add generated documents to workspace 2018-08-15 10:54:32 -07:00
N. Taylor Mullen eec42e9a31 Merge branch 'release/2.2'
# Conflicts:
#	build/dependencies.props
#	korebuild-lock.txt
2018-08-14 11:23:31 -07:00
Marcin Burak 04e58d6ee4 Changed /* */ style comments to // style comments 2018-08-14 11:21:51 -07:00
Ryan Nowak 585e6cd3fe Introduces a 'formatter' for formatting the IR
The new Formatter is used in debugger display, to resolve #2264

The next iteration (assuming we like this) will be to replat our testing
baseline infrastructure on top of this, and then start sharing that with
Blazor - related to #2265.

I found when implementing debugger display that I was duplicating a lot
of details between testing and this.

I also want to convert the Blazor tests to use shared infrastructure.
Right now the Blazor tests use a modified version of the Razor
infrastructure that has different features.
2018-08-13 13:09:49 -07:00
Ajay Bhargav Baaskaran 9a9931d59f
Initial infrastrucure for a better html parser (#2522)
Initial infrastrucure for a better html parser
- Added new syntax node types that follow Roslyn's red/green pattern
- Modified the html text node in the current syntax tree to use the new
nodes
- Updated test infrastructure
- Generated baselines
2018-08-13 11:26:24 -07:00
N. Taylor Mullen 220595393a Expose RazorCompletionFactsService. 2018-08-10 14:52:39 -07:00
Artak 692e09b017
Fixes #2491: Treating RazorCommentTransition-s similar to Transitions in tag content (#2531)
* Treating RazorCommentTransition-s similar to Transitions in tag content
2018-08-10 14:46:58 -07:00
N. Taylor Mullen 572b55690d Refactor completion logic into standalone service.
- Migrated the completion item source provider and the legacy directive completion provider to use the new service.
- Cleaned up duplicate tests that were both verifying common completion functionality.
- Ensured that the legacy `RazorDirectiveCompletionProvider` did not result in additional Razor assembly loads when in C# scenarios.

#2530
2018-08-10 14:46:13 -07:00
N. Taylor Mullen aec88e3eba Change Razor directive completions to use new completions API.
- Kept the same behavior as we previously had with Razor directive completions.
- Attempted adding additional functionalities such as lighting up Razor directive completion when completion was invoked on top of Razor directives (non-C#) but ran into issues involving the core HTML editor not consuming the new completion APIs yet. That's something we'll have to re-visit once they move to the new completion APIs.
- Added tests to validate all aspects of new completion APIs.
- Made completion provider turn on and off based off of feature flag.

#1743
#1813
2018-08-10 11:37:47 -07:00
Ajay Bhargav Baaskaran 3f429d02ab
Merge pull request #2521 from dotnet-maestro-bot/merge/release/2.2-to-master
[automated] Merge branch 'release/2.2' => 'master'
2018-07-31 13:01:44 -07:00
Ajay Bhargav Baaskaran a4b91d6dce Flatten AggregateExceptions in rzc 2018-07-31 11:11:43 -07:00
N. Taylor Mullen 94a1314146 Add IVT to strong name shim for investigative purposes. 2018-07-30 18:07:54 -07:00
N. Taylor Mullen cb557cf771 Changed `GetDesiredIndentation` to be resilient to our SyntaxTree which occasionally has gaps.
- Added a test to cover the scenario.

#2489
2018-07-30 10:45:18 -07:00
N. Taylor Mullen 38e145389e Fix BackgroundDocumentGenerator flaky tests.
- Some time spans were too aggressive for parsing a Razor file on a slow environment.
- Fixed an obvious race where we'd expect 0 pending notifications when it was possible to be in the process of clearing notifications.

#2506
2018-07-27 14:49:12 -07:00
Ajay Bhargav Baaskaran 8e23eb38b4 Honor NoBuild flag during publish 2018-07-26 11:40:38 -07:00
Doug Bunting 684e7855a6
Handle `null` entries correctly for `IsEmptyOrWhiteSpace`
- #2497

nits:
- take VS suggestions
- un-scramble `IsEmptyOrWhiteSpaceCore(...)` for readability
2018-07-23 15:25:41 -07:00
Ajay Bhargav Baaskaran 7f6b05149d Generate deterministic unique ids for tag helpers 2018-07-17 14:01:42 -07:00
Ajay Bhargav Baaskaran 21f2edce16 Generate and verify baselines for ClassifiedSpans and TagHelperSpans
- Moved GetClassifiedSpans and GetTagHelperSpans logic to Razor.Language
2018-07-17 10:54:42 -07:00
N. Taylor Mullen cfd63e1e2e Change HTML splitting logic to not split on surrogate pairs.
- When a surrogate pair is about to be split down the middle we reduce the size of our split by 1 character. This way we split right before a surrogate pair. In the case of zero width joiners, if we split on a zero width joiner we still render valid bytes because the zero width joiner by itself can stand alone.
- Added tests for the various split cases.

#2470
2018-07-13 17:18:56 -07:00
Ajay Bhargav Baaskaran ce4780a830 Renamed symbol to token everywhere
- Updated Resources
- Updated test code
- Regenerated baselines
- Added exclusions for apicheck (See https://github.com/aspnet/BuildTools/issues/704)
2018-07-06 16:29:36 -07:00
Ajay Bhargav Baaskaran a92089d2f9 Converted CSharpDirectivesTest to use baselines 2018-06-26 15:17:36 -07:00
Daniel Eisterhold 7101953c1e Update TagHelperBlockRewriter.cs 2018-06-26 08:24:02 -07:00
Daniel Eisterhold 331f0b15cd Update ServerConnection.cs 2018-06-26 07:54:07 -07:00
Ajay Bhargav Baaskaran 999c24d78d Converted more parser tests to baselines
- Converted CSharpAutoCompleteTest
2018-06-25 11:43:17 -07:00
N. Taylor Mullen fc17ee0749 Update Razor SDK packing logic to not include Pack at properties layer.
- Added test to verify that no-build scenarios work as expected.

#2378
2018-06-20 15:20:01 -07:00
N. Taylor Mullen c7e0207d9d Revert "Update Razor SDK packing logic to not include Pack at properties layer."
This reverts commit 620105cc5e.
2018-06-20 11:39:55 -07:00
Ajay Bhargav Baaskaran b821ce8b8e First step in converting parser tests to use baselines
- Added the necessary infrastructure to serialize and verify the syntax
tree
- Updated ParserVisitor to be overrideable
- Made CSharpVerbatimBlockTest to use baselines
2018-06-19 15:57:05 -07:00
N. Taylor Mullen 620105cc5e Update Razor SDK packing logic to not include Pack at properties layer.
- We now rely on the Razor source inputs layer to add packing to cshtml content items.

#2378
2018-06-19 15:28:50 -07:00
Ajay Bhargav Baaskaran 17e3aa8ee4 Handle pipe name with whitespace properly 2018-06-19 15:10:49 -07:00
Pranav K 9677553a33 Don't specify MainEntryPoint when compiling Razor assembly 2018-06-19 13:31:49 -07:00
N. Taylor Mullen 41fad8a33a Don't smart indent code inside of Razor block constructs.
- Prior to this change we weren't strict enough with where our smart indenter ran. We made the assumption that every code block could be smart indented and then Roslyn would "do the right thing". However, in nested code block scenarios we found that Roslyn and us would both indent resulting in extra newlines. These changes make the criteria for applying smart indentation a little stricter.
- Updated directive code block parsing to add a C# marker symbol in cases of an empty code block directive.
- Added unit tests to verify new smart indenter behavior.
- Updated existing tests to expect new syntax tree marker symbol for empty directive bits.
- Regenerated baselines.

#2410
2018-06-18 20:38:01 -07:00
N. Taylor Mullen 1aa15374b5 Add partial parsing of `@functions` directive body.
- Added ability to understand valid inserts, deletes and replacements for the `@functions` directive (and any other directive that uses our extensible code block bits).
- Added unit tests.
- Updated existing tests.
- Found an issue when completing some C# items the auto-completions would impact the underlying snapshot after we'd captured the change. Fixed this by forcing a reparse when we detect that our understanding of the latest snapshot and the actual latest snapshot diverge.

#2408
2018-06-18 17:11:40 -07:00
Pranav K dbf13d6538 Changes per PR comments 2018-06-15 13:53:38 -07:00
Pranav K a57b7c4d7f Don't discover tag helpers if some references are missing
A common cause for runtime view compilation failure in MVC is when an application is published
without reference assemblies. MVC usually handles this at compilation, by looking for specific
error codes. More recently, TagHelper discovery fails with an not-so-helpful error message in this
scenario. This change attempts to add a little more error checking to cover the most common cases
2018-06-15 13:53:38 -07:00
N. Taylor Mullen d6f3a1bd22 Enable using directive IntelliSense auto-completion.
- Allow identical `@using` directives in the primary document. This means that if a user types `@using System` twice in the primary document (i.e. `Index.cshtml`) then we'll generate that using statement twice; this enables proper C# IntelliSense to light up on both using statements and allows auto-completion to work because there's no more magical distinction logic for Razor code that is in the current document.
- Prior to this change if you had two identical using statements in the same document one would be in no-mans land mapped to nothing (not C#, not HTML) and the other would be mapped to C#; the second a user differentiated the two statements (i.e. adding a `.`) we'd distinctify the using statements resulting in an invalid completion.
- This PR has an end-user impact where they will now receive the normal C# warning about having duplicate using. I treated this prior behavior more as a bug because we threw away the first using directive instance which impacted editing and in general was a silly thing to correct for the user.
- Added new integration test showing how using directives are not de-duplicated in the primary document.

#1255
2018-06-15 13:17:09 -07:00
Ryan Nowak af63afdae7 Add partial parsing for parenthesis
- This is part of a fix for #1255 - this change enables signature help in implicit expressions by improving the partial parsing. We're now smart enough about the contents of an implicit expression and attempt to balance parenthesis to determine if we should not full parse.

#1255
2018-06-15 11:22:03 -07:00
Ryan Brandenburg 1779625d74 Set 2.1 baselines 2018-06-14 16:43:22 -07:00
N. Taylor Mullen dc76027a7a Generate line pragmas even for whitespace.
- We need to pre-emptively generate line pragmas to handle C# scenarios which are session based. For instance, if a C# completion session starts at a location without a pragma they capture the origination point; at which point if a user keeps typing we generate a line pragma drastically changing where the copmletion started resulting in a broken C# completion experience.
- Updated test files to reflect new behavior.

#2299
2018-06-11 14:48:38 -07:00
N. Taylor Mullen b2ec939006 Make brace indenter smarter about making edits to non-valid content kinds.
- Prior to this change our brace smart indenter would indent JavaScript blocks incorrectly because it didn't take into account where in a Razor file the brace that it was indenting existed.
- Made it so the brace smart indenter only functions in code/metacode locations within the SyntaxTree.
- Updated and added tests to account for new behavior.

#2297
2018-06-11 10:34:26 -07:00
Ajay Bhargav Baaskaran ad07036020 Use checksum for classname if filepath is null 2018-06-11 08:25:57 -07:00
Ryan Nowak e248f2fb2a Rename a file 2018-06-06 09:30:24 -07:00
Nate McMaster 83684abab4
Add certificate names for code signing 2018-06-05 22:34:33 -07:00
N. Taylor Mullen eaa5e30132 Add LiveShare test project to IVT. 2018-05-31 16:32:18 -07:00
N. Taylor Mullen 56d69db0fa Add Razor document tracking to FallbackRazorProjectHost.
- VisualStudio defaults to adding a `<none>` link item when right click -> add existing item for Razor files; therefore, this also includes the knowledge of the "None" item group when finding Razor files.
- Added unit and functional tests to verify the new `FallbackRazorProjectHost` behavior.
- Added new schema items to represent the `Content` and `None` item type information (pulled from the project system repo).

#2373
2018-05-30 11:15:25 -07:00
Pranav K 1b6ca7f55a Allow publish to work when BuildProjectReferences=false
Fixes #2363
2018-05-25 11:13:26 -07:00
N. Taylor Mullen 93d8a93498 Enable serialization of `TagHelperDescriptor`s.
- Added ability for TagHelpers to write their own json output.
2018-05-22 16:48:26 -07:00
Ajay Bhargav Baaskaran f9d4fba39d Added a taghelpers and imports overload to Process and ProcessDesignTime
We want to have a way to specify the taghelper descriptors and imports to use while
processing a specific document.
- Added an overload to Process and ProcessDesignTime to take in a list
TagHelperDescriptors and a list of imports
- Added the corresponding CreateCodeDocumentCore overload
- Added GetTagHelpers and SetTagHelpers extension methods for
CodeDocument
- Added the necessary plumbing to use the taghelpers from the
CodeDocument when available and fallback logic.
- Added DocumentImportsTracker and updated background code generation
logic to use the new overload
- Added/updated tests
2018-05-22 11:40:21 -07:00
N. Taylor Mullen 59baad17da Merge branch 'rel/vs15.8' into dev 2018-05-21 10:48:16 -07:00
Ryan Nowak 4ac8b21978 Fix dispose logic for EditorDocument
This could throw when the document is disposed and wasn't open in the
editor.

Improved the tests to cover dispose as well for both cases.
2018-05-20 16:39:46 -07:00
Ryan Nowak a35ef53891 Fix mef attributes project path provider 2018-05-19 13:06:24 -07:00
N. Taylor Mullen 95d41507fc Add `ProjectPathProvider` abstract for document tracker creation.
- First iteration of live share replaced the document tracker factory entirely; however, this will be prone to breaking changes in the future when me make changes to document tracker to not rely on a file path. To pre-emptively prevent breaking changes I added a project path provider that can be overridden in the live share case. Note that one big difference here between old and new is that instead of being a MEF service implementation for the project path resolution we're bringing that to the Workspace service level.
- Added tests to validate the two flows of the default project path provider.
2018-05-17 15:28:20 -07:00
N. Taylor Mullen 9a249ffcc1 Add a LiveShare project snapshot base to make it easier to detect breaking changes. 2018-05-17 12:48:23 -07:00
N. Taylor Mullen e8c8396298 Upgrade to VS 15.8 Preview 2 version of Roslyn. 2018-05-16 15:50:54 -07:00
Ryan Nowak 9b911cbb6e Add some benchmarks for project system
Adds a few benchmarks for things we're working on, also addressed a few
small perf issues that have an impact for large documents.
2018-05-16 13:21:39 -07:00
N. Taylor Mullen 7c70207594 Made the Visual Studio parser smarter about overlapping reparse requests.
- Prior to this the parser would think that a non-latest reparse request was the latest because the only way we would check to see if a change reference was "latest" would be to do an equality check on the snapshot and `SourceChange`; the issue here was that `SourceChange` was null but the snapshots were the same. Problems could arise with this due to project context changes.
- Added tests to validate the new reparse behavior.
- Renamed `Edit` in the `BackgroundParser` to `ChangeReference` also refactored all the "edit" text in `BackgroundParser` to be `ChangerReference` like.
- Added a new event args to be the DTO between the internal and external parser implementations. This is how we could pas additional information in order to determine "latest" change reference.

#2336
2018-05-14 11:54:56 -07:00
Ryan Nowak a412299881 Add a Razor design time build
This allows Razor to know what files belong to the project.
2018-05-14 09:41:15 -07:00
Ryan Nowak fafdd7e3af Track the open/closed state of documents
This change intoduces content changes to our project snapshots. We now
know the open/closed state of documents that are initialized by the
Razor project system and listen to the correct data source based on
whether the file is open in the editor.

There are a few other random improvements in here as well like a
workaround for the upcoming name change to our OOP client type.
2018-05-11 08:18:08 -07:00
N. Taylor Mullen e0e1c39cce Added a LiveShareWorkspaceProvider to enable location of the remote workspace in live share scenarios.
- MEF is the primary means of resolving the new live share provider therefore we allow it to not be registered.
- The new contract is in the Editor.Razor binary so the LiveShare bits don't have to take the dependency on the windows binary in Razor (has a lot of baggage).
- This is specific to live share but providing a generic way to resolve workspaces didn't seem reasonable given the varying expectations in VS4Mac. If we need to make a more generic solution in the future we'll revisit this; for now this is a straight forward inclusion of live share functionality.
- Added tests to validate the new behavior.
- This unblocks the live share scenario of resolving the remote workspace. We can't rely on the projection buffers to provide the correct workspace because that workspace is wired up too late in the process of opening a Razor file.

#2335
2018-05-08 16:54:43 -07:00
Ryan Nowak 1d5245c421 Reorganize file tracker
This is precursor to a much bigger change. Pushing out some of the
changes that have broad impact early to make it easier to review the
real change.
2018-05-08 16:27:51 -07:00
Ajay Bhargav Baaskaran f150ee329a Merge branch 'release/2.1' into dev 2018-05-03 11:19:46 -07:00
N. Taylor Mullen dbed73da32 Remove ProjectService requirements for Razor text buffer initialization.
- Now that we have our own content type the editor does the work of determining if a Razor file opened in a core project should flow to our code.
2018-05-03 11:13:36 -07:00
Ryan Nowak e0612d7e07 Fixes for the document window state 2018-05-03 10:28:13 -07:00
Ajay Bhargav Baaskaran 41c0a69c5b Allow build server to run on net46 2018-05-02 16:17:09 -07:00
Pranav K 1a2ca58eba
Merge pull request #2324 from aspnet/release/2.1
Merge release/2.1
2018-05-01 19:31:26 -07:00
Pranav K a94323499b Change CopyToPublishDirectory on Content items instead of explicitly removing this from publish items
Fixes #2295
2018-05-01 16:50:49 -07:00
Pranav K 05c84f008a Ensure Views dll are copied during P2P builds
FastUpToDateCheck in VS doesn't account for changes solely to .Views.dll. This causes referencing projects to be treated as
up to date even though a referenced project rebuilt. Touch the marker file to cause referenced projects to rebuild.

Fixes https://github.com/aspnet/Razor/issues/2306

to cause it to treat
2018-05-01 16:50:49 -07:00
Pranav K 8d99ba53ce Make incremental build in VS copy output files
Fixes #2306
2018-05-01 16:50:49 -07:00
Ajay Bhargav Baaskaran 7cba5ed593 Fix flaky test failure in ServerCommandTest 2018-04-30 16:32:18 -07:00
N. Taylor Mullen c59dcb9b4c Add IVT for Razor.LiveShare.Test. 2018-04-30 16:13:40 -07:00
Ryan Nowak f67458f156 Fix #2298 simplify TagHelperDescriptor hash
The hash code implementation here is exhaustive when it doesn't need to
be. Slimming this down to a much more reasonable set of things for perf
reasons.
2018-04-30 13:55:55 -07:00
N. Taylor Mullen 2885b4b138 Make document tracker resilient to multiple subscribes.
- Added tests to verify new functionality.

#2314
2018-04-30 12:03:13 -07:00
N. Taylor Mullen ee9537bebd Add Razor.LiveShare IVT to Editor.Razor. 2018-04-27 10:57:10 -07:00
N. Taylor Mullen ad66ebb220 Add Razor.LiveShare IVT to CodeAnalysis.Razor. 2018-04-26 15:45:06 -07:00
N. Taylor Mullen 49299d78a4 Add Razor.LiveShare IVT to Razor.Workspaces. 2018-04-25 17:25:56 -07:00
Ryan Nowak e2edc280c5 Add documents, engine, tag helpers to snapshot
The project snapshot now maintains a RazorProjectEngine as well as set
of Tag Helpers that are known for that snapshot.

Pivoted some more services to be snapshot-centric.

Also added the ability to track .cshtml documents to the project system.
For now most components just ignore document changes.
2018-04-25 19:05:54 -04:00
Pranav K 1e2a1405e5
Update tests to target netcoreapp2.1 2018-04-25 10:27:07 -07:00
Pranav K a6a5e4ea10
Simplify building Microsoft.AspNetCore.Razor.Design 2018-04-25 10:27:07 -07:00
Nate McMaster b956aa0c80
Merge branch 'release/2.1' into dev 2018-04-23 19:02:19 -07:00
Nate McMaster 0d047d64f3
Remove explicit reference to NETStandard.Library when using .NET Framework 2018-04-23 13:32:50 -07:00
Ajay Bhargav Baaskaran 2eb9d4d783 Merge branch 'rel/vsmac15.7' into dev 2018-04-20 13:48:35 -07:00
Ajay Bhargav Baaskaran 2be905def4 Make newline comparison work crossplat 2018-04-20 13:34:14 -07:00
Ajay Bhargav Baaskaran d2fe76be21 Write process and pipe information to a pid file 2018-04-18 14:51:28 -07:00
Ajay Bhargav Baaskaran dc997821cc Added nuspec and symbols.nuspec files to Razor.Design 2018-04-17 11:07:34 -07:00
Pranav K 95835d6c37 Continue generating RelatedAssemblyPart on assembly if GenerateAssemblyInfo=false
Fixes #2257
2018-04-13 16:14:37 -07:00
Ajay Bhargav Baaskaran 60b6ec047d Don't fail the build when ExtensionDependencyChecker fails 2018-04-13 15:55:39 -07:00
Pranav K 8d1de6ec80 Make sure RazorSdk works when BuildingInVisualStudio \ BuildProjectReferences is disabled
Fixes #2247
2018-04-13 14:35:04 -07:00
Ajay Bhargav Baaskaran f8dc5c4702 Obsoleted IRazorEngineBuilder APIs 2018-04-13 12:35:53 -07:00
Pranav K 9365fcd053 Don't publish the refs directory when the app does not have any Razor files
Fixes https://github.com/aspnet/Razor/issues/2246
2018-04-11 15:20:16 -07:00
Ajay Bhargav Baaskaran 6d9df1ef33 Noop Razor Sdk for F# projects 2018-04-11 14:18:19 -07:00
Ajay Bhargav Baaskaran 5504374125 Preserve directive node diagnostics in document node 2018-04-10 10:24:21 -07:00
Ajay Bhargav Baaskaran 6270c1f47e Merge branch 'rel/vs15.7' into dev 2018-04-05 16:28:17 -07:00
Ryan Nowak 4cd24a2b08 Add experimental flag to un-special-case data-
This change allows blazor to opt into treating data- attributes the same
way as normal attributes in the parser.
2018-04-05 15:27:04 -07:00
Ryan Nowak d1c0ab587c Add support for type parameters to class nodes
This change will allow someone extending Razor to use generic type
parameters in generated classes.

There's no user-level extensibility provided here yet, as in there is no
language support for adding type parameters.
2018-04-05 15:26:42 -07:00
Ajay Bhargav Baaskaran ae42d7599d Show error if page directive is not at the top of file 2018-04-04 17:27:10 -07:00
Ajay Bhargav Baaskaran b1007744b0 Added PipeOptions.CurrentUserOnly option to the named pipe streams
Don't run on server if CurrentUserOnly is not available
2018-04-04 09:53:36 -07:00
Ajay Bhargav Baaskaran a2a920dde5 Normalize the tool assembly path before using it as the base for pipe name 2018-03-29 12:50:51 -07:00
Ajay Bhargav Baaskaran 03938dfd95 Handle Mutex creation exceptions 2018-03-28 18:23:30 -07:00
Pranav K 1e11b5fa95 Make PreserveCompilationContext=true 2018-03-26 14:23:29 -07:00
Ajay Bhargav Baaskaran 7bc54b99e0 Use tool assembly path for computing default pipe name 2018-03-23 16:50:20 -07:00
Ajay Bhargav Baaskaran adc7184d98 Register missed directives in RazorPageGenerator 2018-03-23 12:36:23 -07:00