├── src
├── LanguageModel.Tests
│ ├── CorrectSampleLuaFiles
│ │ ├── concat.lua
│ │ ├── tabs.lua
│ │ ├── assignment.lua
│ │ ├── SemiColonStatement.lua
│ │ ├── longcomment.lua
│ │ ├── AssignmentForIORead.lua
│ │ ├── BreakIfStatement.lua
│ │ ├── FunctionCallStatement.lua
│ │ ├── test.lua
│ │ ├── trivia1.lua
│ │ ├── EquivalentAssignmentWithNewLine2.lua
│ │ ├── MultipleTypeAssignment.lua
│ │ ├── NestedFunctionCallStatement.lua
│ │ ├── TripleNestedFunctionCall.lua
│ │ ├── newlines.lua
│ │ ├── smallif.lua
│ │ ├── EquivalentAssignmentWithNewLine1.lua
│ │ ├── FunctionDefError.lua
│ │ ├── IfStatement.lua
│ │ ├── GenericForStatement.lua
│ │ ├── StringConcat.lua
│ │ ├── AssignmentWithFunctionCall.lua
│ │ ├── FunctionCallChainingStatement.lua
│ │ ├── ReturnStatementInFunction.lua
│ │ ├── FunctionCallWithStringLiteral.lua
│ │ ├── Assignments.lua
│ │ ├── ForInStatement.lua
│ │ ├── FunctionCallWithTableConstructor.lua
│ │ ├── RepeatStatement.lua
│ │ ├── MultipleReturnIf.lua
│ │ ├── WhileStatement.lua
│ │ ├── IfElse.lua
│ │ ├── IfElseIf.lua
│ │ ├── FunctionAssignment.lua
│ │ ├── ComplexTableConstructor.lua
│ │ ├── LocalAssignments.lua
│ │ ├── TailCall.lua
│ │ ├── ForStatements.lua
│ │ ├── NestedTableConstructor.lua
│ │ ├── leveled_blocks.lua
│ │ ├── VarArgFunction.lua
│ │ ├── ForStatementWithVariables.lua
│ │ ├── NestedFunctionDef.lua
│ │ ├── ComplexFunctionCall.lua
│ │ ├── InvalidProgramsMemoryException.lua
│ │ ├── TableStatements.lua
│ │ ├── nestedif.lua
│ │ ├── if.lua
│ │ ├── longs.lua
│ │ └── InvalidProgramsAsStrings.lua
│ ├── TestGeneration
│ │ ├── ValidatedGeneratedTests
│ │ │ ├── EmptyProgram_Generated.cs
│ │ │ ├── GrabKeyFromTable_Generated.cs
│ │ │ ├── SimpleTableError_Generated.cs
│ │ │ ├── BracketError_Generator.cs
│ │ │ ├── PrefixExpFirst_Generated.cs
│ │ │ ├── NestedTable_Generated.cs
│ │ │ ├── FunctionDefError_Generated.cs
│ │ │ ├── SmallIf_Generated.cs
│ │ │ └── MultipleTypeAssignment_Generated.cs
│ │ ├── UnvalidatedGeneratedTests
│ │ │ ├── 27_Generated.cs
│ │ │ ├── 13_Generated.cs
│ │ │ ├── 12_Generated.cs
│ │ │ ├── 29_Generated.cs
│ │ │ ├── 26_Generated.cs
│ │ │ ├── 3_Generated.cs
│ │ │ ├── 14_Generated.cs
│ │ │ ├── 0_Generated.cs
│ │ │ ├── 21_Generated.cs
│ │ │ ├── 6_Generated.cs
│ │ │ ├── 7_Generated.cs
│ │ │ └── 22_Generated.cs
│ │ └── Tester.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── LuaVSHost
│ ├── ClassDiagram1.cd
│ ├── Key.snk
│ ├── Resources
│ │ └── Lua.Host.ico
│ ├── LuaLanguageServicePackage.pkgdef
│ ├── Errors
│ │ ├── ErrorListItem.cs
│ │ ├── TaskExtensions.cs
│ │ └── ErrorTaggerProvider.cs
│ ├── Formatting
│ │ ├── OptionPages
│ │ │ ├── BaseDialogPage.cs
│ │ │ ├── UserControls
│ │ │ │ ├── GeneralUserControl.xaml.cs
│ │ │ │ ├── SpacingUserControl.xaml.cs
│ │ │ │ ├── WrappingAndNewLineUserControl.xaml.cs
│ │ │ │ └── GeneralUserControl.xaml
│ │ │ ├── GeneralPage.cs
│ │ │ ├── SpacingPage.cs
│ │ │ └── WrappingAndNewLinePage.cs
│ │ ├── SmartIndentation
│ │ │ ├── SmartIndentProvider.cs
│ │ │ └── SmartIndent.cs
│ │ └── IFormatter.cs
│ ├── Shared
│ │ ├── ICore.cs
│ │ ├── ContentTypes.cs
│ │ ├── ISingletons.cs
│ │ ├── Guids.cs
│ │ ├── EditorUtilities.cs
│ │ ├── Core.cs
│ │ ├── Constants.cs
│ │ ├── BufferExtensions.cs
│ │ ├── IMiniCommandFilter.cs
│ │ └── CommandFilter.cs
│ ├── Navigation
│ │ └── IDocumentOperations.cs
│ ├── LuaLanguageService.cs
│ ├── LuaContentTypes.cs
│ ├── Intellisense
│ │ ├── CompletionSourceProvider.cs
│ │ └── CompletionHandlerProvider.cs
│ ├── Text
│ │ └── SourceTextCache.cs
│ ├── Classifications
│ │ ├── LuaClassificationTypeDefinition.cs
│ │ └── TaggerProvider.cs
│ ├── source.extension.vsixmanifest
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── LuaLanguageServicePackage.cs
│ └── LuaLanguageServiceThemes.pkgdef
├── LanguageModel
│ ├── Key.snk
│ ├── LanguageModel
│ │ ├── ParseContexts.cs
│ │ ├── ParseError.cs
│ │ ├── Trivia.cs
│ │ ├── SyntaxTree.cs
│ │ ├── SyntaxNode.cs
│ │ └── Token.cs
│ ├── Classification
│ │ ├── TagInfo.cs
│ │ └── Classification.cs
│ ├── Formatting
│ │ ├── Ruling
│ │ │ ├── RuleOperation.cs
│ │ │ ├── Rule.cs
│ │ │ ├── RuleAction.cs
│ │ │ ├── RuleBucket.cs
│ │ │ ├── RuleOperationContext.cs
│ │ │ ├── RuleDescriptor.cs
│ │ │ ├── DeleteSpaceBeforeEofToken.cs
│ │ │ └── DeleteTrailingWhitespace.cs
│ │ ├── Options
│ │ │ ├── OptionalRuleGroup.cs
│ │ │ ├── GlobalOptions.cs
│ │ │ ├── FormattingOptions.cs
│ │ │ └── DisableableRules.cs
│ │ ├── TextEditInfo.cs
│ │ └── FormattingContext.cs
│ ├── Text
│ │ └── SourceTextLine.cs
│ ├── Diagnostics
│ │ ├── DiagnosticsProvider.cs
│ │ └── IDiagnosticsProvider.cs
│ ├── Shared
│ │ └── Range.cs
│ ├── ParseTreeCache.cs
│ ├── LuaFeatureContainer.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SourceText.cs
├── ProjectLauncher
│ ├── Key.snk
│ ├── Resources
│ │ ├── Images.png
│ │ └── Package.ico
│ ├── LuaDetour
│ │ ├── LuaDebug32.dll
│ │ └── LuaDetours.dll
│ ├── PkgCmdIDList.cs
│ ├── GuidList.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── source.extension.vsixmanifest
│ ├── LaunchForm.cs
│ ├── LuaLanguageServiceThemes.pkgdef
│ └── Resources.Designer.cs
├── LuaDebuggerLauncher
│ ├── tools
│ │ ├── Xaml2Cs.exe
│ │ └── CommonProjectSystemExtension.props
│ ├── [PlatformName]
│ │ ├── ImportBefore
│ │ │ └── Lua.props
│ │ └── ImportAfter
│ │ │ ├── Lua.targets
│ │ │ └── LuaDebugger.xaml
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── source.extension.vsixmanifest
│ └── RuleProperties.cs
├── Directory.Build.props
├── stylecop.json
├── version.json
├── Microsoft.VisualStudio.Debugger.Lua
│ ├── AD7.Impl
│ │ ├── EngineConstants.cs
│ │ ├── AD7Expression.cs
│ │ └── AD7MemoryAddress.cs
│ ├── Variable.cs
│ ├── Frame.cs
│ ├── Commands.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── EngineRegistration.pkgdef
│ ├── Engine.Impl
│ │ ├── EngineUtils.cs
│ │ └── BreakpointManager.cs
│ ├── DLLInjector.cs
│ └── AD7.Definitions
│ │ └── AD7Guids.cs
└── Formatting.Tests
│ ├── Properties
│ └── AssemblyInfo.cs
│ └── FormatRulesAndIndentation
│ ├── MixedTests.cs
│ ├── ForLoopTests.cs
│ ├── DotColonTests.cs
│ └── TrailingWhitespaceTests.cs
├── images
├── colorization.png
├── intelliSense.png
└── errorsquiggles.png
├── nuget.config
├── appveyor.yml
├── license.txt
├── CONTRIBUTING.md
├── README.md
└── .gitattributes
/src/LanguageModel.Tests/CorrectSampleLuaFiles/concat.lua:
--------------------------------------------------------------------------------
1 | ..
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/tabs.lua:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/assignment.lua:
--------------------------------------------------------------------------------
1 | x = 0
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/SemiColonStatement.lua:
--------------------------------------------------------------------------------
1 | ;
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/longcomment.lua:
--------------------------------------------------------------------------------
1 | x --[[comment]]
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/AssignmentForIORead.lua:
--------------------------------------------------------------------------------
1 | a = io.read("*number")
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/BreakIfStatement.lua:
--------------------------------------------------------------------------------
1 | if a[i] == v then break end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/FunctionCallStatement.lua:
--------------------------------------------------------------------------------
1 | runSampleTest(true, 5)
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/test.lua:
--------------------------------------------------------------------------------
1 | end
2 |
3 | --98098098
4 | x =
5 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/trivia1.lua:
--------------------------------------------------------------------------------
1 | x
2 |
3 |
4 | x
--------------------------------------------------------------------------------
/src/LuaVSHost/ClassDiagram1.cd:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/LuaVSHost/Key.snk
--------------------------------------------------------------------------------
/images/colorization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/images/colorization.png
--------------------------------------------------------------------------------
/images/intelliSense.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/images/intelliSense.png
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/EquivalentAssignmentWithNewLine2.lua:
--------------------------------------------------------------------------------
1 | a = 1 b = a*2
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/MultipleTypeAssignment.lua:
--------------------------------------------------------------------------------
1 | x,y,var = "string", 4, {}
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/NestedFunctionCallStatement.lua:
--------------------------------------------------------------------------------
1 | print(type(10.4*3))
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/TripleNestedFunctionCall.lua:
--------------------------------------------------------------------------------
1 | print(type(type(X)))
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/newlines.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/smallif.lua:
--------------------------------------------------------------------------------
1 | if true == "+" then
2 | run();
3 | end
--------------------------------------------------------------------------------
/images/errorsquiggles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/images/errorsquiggles.png
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/EquivalentAssignmentWithNewLine1.lua:
--------------------------------------------------------------------------------
1 | a = 1
2 | b = a*2
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/FunctionDefError.lua:
--------------------------------------------------------------------------------
1 | foo = function
2 | return
3 | end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/IfStatement.lua:
--------------------------------------------------------------------------------
1 | if op == "+" then
2 | r = a + b
3 | end
--------------------------------------------------------------------------------
/src/LanguageModel/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/LanguageModel/Key.snk
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/GenericForStatement.lua:
--------------------------------------------------------------------------------
1 | for i,v in ipairs(a) do print(v) end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/StringConcat.lua:
--------------------------------------------------------------------------------
1 | print("Hello " .. "World") --> Hello World
--------------------------------------------------------------------------------
/src/ProjectLauncher/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/ProjectLauncher/Key.snk
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/AssignmentWithFunctionCall.lua:
--------------------------------------------------------------------------------
1 | b = string.gsub(a, "one", "another")
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/FunctionCallChainingStatement.lua:
--------------------------------------------------------------------------------
1 | prefixExp():runSampleTest(true, 5)
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/ReturnStatementInFunction.lua:
--------------------------------------------------------------------------------
1 | function foo ()
2 | return;
3 | end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/FunctionCallWithStringLiteral.lua:
--------------------------------------------------------------------------------
1 | print [[a multi-line
2 | message]]
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/Assignments.lua:
--------------------------------------------------------------------------------
1 | a = "hello" .. "world"
2 | t.n = t.n + 1
3 | a, b = 10, 2*x
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/ForInStatement.lua:
--------------------------------------------------------------------------------
1 | for i, v in ipairs(a) do
2 | print(i, v)
3 | end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/FunctionCallWithTableConstructor.lua:
--------------------------------------------------------------------------------
1 | rename{old="temp.lua", new="temp1.lua"}
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/RepeatStatement.lua:
--------------------------------------------------------------------------------
1 | repeat
2 | line = os.read()
3 | until line ~= ""
4 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Resources/Lua.Host.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/LuaVSHost/Resources/Lua.Host.ico
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/MultipleReturnIf.lua:
--------------------------------------------------------------------------------
1 | if t[i] ~= nil then
2 | return t[i], unpack(t, i + 1)
3 | end
--------------------------------------------------------------------------------
/src/LuaDebuggerLauncher/tools/Xaml2Cs.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/LuaDebuggerLauncher/tools/Xaml2Cs.exe
--------------------------------------------------------------------------------
/src/ProjectLauncher/Resources/Images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/ProjectLauncher/Resources/Images.png
--------------------------------------------------------------------------------
/src/ProjectLauncher/Resources/Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/ProjectLauncher/Resources/Package.ico
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/WhileStatement.lua:
--------------------------------------------------------------------------------
1 | local i = 1
2 | while a[i] do
3 | print(a[i])
4 | i = i + 1
5 | end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/IfElse.lua:
--------------------------------------------------------------------------------
1 | if op == "+" then
2 | r = a + b
3 | else
4 | error("invalid operation")
5 | end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/IfElseIf.lua:
--------------------------------------------------------------------------------
1 | if op == "+" then
2 | r = a + b
3 | elseif op == "-" then
4 | r = a - b
5 | end
--------------------------------------------------------------------------------
/src/LuaVSHost/LuaLanguageServicePackage.pkgdef:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/LuaVSHost/LuaLanguageServicePackage.pkgdef
--------------------------------------------------------------------------------
/src/ProjectLauncher/LuaDetour/LuaDebug32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/ProjectLauncher/LuaDetour/LuaDebug32.dll
--------------------------------------------------------------------------------
/src/ProjectLauncher/LuaDetour/LuaDetours.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/VSLua/HEAD/src/ProjectLauncher/LuaDetour/LuaDetours.dll
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/FunctionAssignment.lua:
--------------------------------------------------------------------------------
1 | local fact
2 | fact = function (n)
3 | if n == 0 then return 1
4 | end end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/ComplexTableConstructor.lua:
--------------------------------------------------------------------------------
1 | y = {x=10, ["x"]=0, y=45; "one", print("hello world"), [3] = {x=10}, "two", "three"}
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/LocalAssignments.lua:
--------------------------------------------------------------------------------
1 | local a2 = 2*a
2 | local d = sqrt(b^2 - 4*a*c)
3 | local x1 = (-b + d)/a2
4 | local f = 10
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/TailCall.lua:
--------------------------------------------------------------------------------
1 | function room3 ()
2 | local move = io.read()
3 | if move == "north" then return room1()
4 | end
5 | end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/ForStatements.lua:
--------------------------------------------------------------------------------
1 | for var=exp1,exp2,exp3 do
2 | something();
3 | end
4 |
5 | for i=1,f(x) do print(i) end
6 |
7 | for i=10,1,-1 do print(i) end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/NestedTableConstructor.lua:
--------------------------------------------------------------------------------
1 | network = {
2 | {name = "grauna", IP = "210.26.30.34"},
3 | {name = "arraial", IP = "210.26.30.23"},
4 | }
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/leveled_blocks.lua:
--------------------------------------------------------------------------------
1 | x = [==========[leveled string]==========]
2 | y = [[adsf
3 | asf]]
4 | z = [= unfinished
5 | y = [==========================[ onesided!
6 | ds
--------------------------------------------------------------------------------
/src/LuaDebuggerLauncher/tools/CommonProjectSystemExtension.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/VarArgFunction.lua:
--------------------------------------------------------------------------------
1 | function fwrite (fmt, ...)
2 | return io.write(string.format(fmt, unpack(arg)))
3 | end
4 |
5 | function print (...)
6 | print("");
7 | end
8 |
9 | function g (a, b, ...) end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/ForStatementWithVariables.lua:
--------------------------------------------------------------------------------
1 | for var=exp1,exp2,exp3 do
2 | something();
3 | end
4 |
5 | for i=1,f(x) do print(i) end
6 |
7 | for i=10,1,-1 do print(i) end
8 |
9 | for i=f(true),1 do print(i) end
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/NestedFunctionDef.lua:
--------------------------------------------------------------------------------
1 | function digitButton (digit)
2 | return Button{ label = digit,
3 | action = function ()
4 | add_to_display(digit)
5 | end
6 | }
7 | end
--------------------------------------------------------------------------------
/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/stylecop.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
3 | "settings": {
4 | "documentationRules": {
5 | "companyName": "Microsoft",
6 | "xmlHeader": false
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/ProjectLauncher/PkgCmdIDList.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | namespace ProjectLauncher
4 | {
5 | using System;
6 |
7 | ///
8 | /// MUST match PkgCmdID.h
9 | ///
10 | internal static class PkgCmdIDList
11 | {
12 | public const uint cmdidProjectLauncher = 0x100;
13 | }
14 | }
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/ComplexFunctionCall.lua:
--------------------------------------------------------------------------------
1 | _Window(options.title,
2 | options.x or 0, -- default value
3 | options.y or 0, -- default value
4 | options.width, options.height,
5 | options.background or "white", -- default
6 | options.border -- default is false (nil)
7 | )
--------------------------------------------------------------------------------
/src/LuaDebuggerLauncher/[PlatformName]/ImportBefore/Lua.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | LuaDebugger
5 |
6 |
--------------------------------------------------------------------------------
/src/LuaDebuggerLauncher/[PlatformName]/ImportAfter/Lua.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/InvalidProgramsMemoryException.lua:
--------------------------------------------------------------------------------
1 | "
2 | x,
3 | y = 1,2"
4 |
5 |
6 | "x,y = 1,2"
7 | "function foo(x,y,z)"
8 |
9 | "{ x, y,}"
10 |
11 | "x,y"
12 |
13 | "
14 | x
15 |
16 | x "
17 |
18 | "
19 | x = 10
20 | -- comment here
21 | --[[ block
22 | comment
23 | here]]
24 | x = x + 1 "
25 |
26 | "x
27 | "
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/TableStatements.lua:
--------------------------------------------------------------------------------
1 | a = {} -- create a table and store its reference in `a'
2 | k = "x"
3 | a[k] = 10 -- new entry, with key="x" and value=10
4 | a[20] = "great" -- new entry, with key=20 and value="great"
5 | print(a["x"]) --> 10
6 | k = 20
7 | print(a[k]) --> "great"
8 | a["x"] = a["x"] + 1 -- increments entry "x"
9 | print(a["x"]) --> 11
--------------------------------------------------------------------------------
/src/LuaVSHost/Errors/ErrorListItem.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Shell;
2 | using Microsoft.VisualStudio.Text;
3 |
4 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Errors
5 | {
6 | internal class ErrorListItem : ErrorTask
7 | {
8 | public ErrorListItem(SnapshotSpan errorSpan)
9 | {
10 | this.ErrorSpan = errorSpan;
11 | }
12 |
13 | public SnapshotSpan ErrorSpan { get; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3 | "version": "1.1",
4 | "publicReleaseRefSpec": [
5 | "^refs/heads/master$", // we release out of master
6 | "^refs/heads/v\\d+(?:\\.\\d+)?$" // we also release out of vNN branches
7 | ],
8 | "cloudBuild": {
9 | "buildNumber": {
10 | "enabled": true
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/nestedif.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | if true == "+" then
4 | test;
5 | if false .. "+" then
6 | if(yolo) or hello then
7 | run();
8 | end
9 | elseif 345 then
10 | lol = true;
11 | end
12 | end
13 | end
14 |
15 | if plusString | "+" then --testcomment
16 | if (test) and {[hello] = world ;[test] = 5, me = "Kevin"} then
17 | main();
18 | else
19 |
20 | end
21 | return true;
22 | end
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.Debugger.Lua/AD7.Impl/EngineConstants.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.VisualStudio.Debugger.Lua
2 | {
3 | public static class EngineConstants
4 | {
5 | ///
6 | /// This is the engine GUID of the sample engine. It needs to be changed here and in EngineRegistration.pkgdef
7 | /// when turning the sample into a real engine.
8 | ///
9 | public const string EngineId = "{FE72992A-F091-45CA-B9C6-B653D374AA61}";
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/LanguageModel/LanguageModel/ParseContexts.cs:
--------------------------------------------------------------------------------
1 | namespace LanguageService
2 | {
3 | public enum ParsingContext
4 | {
5 | IfBlock,
6 | ChunkNodeBlock,
7 | ElseBlock,
8 | ElseIfBlock,
9 | DoStatementBlock,
10 | WhileBlock,
11 | RepeatStatementBlock,
12 | ForStatementBlock,
13 | FuncBodyBlock,
14 | ExpList,
15 | NameList,
16 | VarList,
17 | FieldList,
18 | FuncNameDotSeperatedNameList,
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/if.lua:
--------------------------------------------------------------------------------
1 |
2 |
3 | if op == "+" then
4 | r = a + b
5 | elseif op == "-" then
6 | r = a - b
7 | originRoom:removeWall(WEST);
8 | Generator.maze:GetValue(coordinates.x - 1, coordinates.y):removeWall(EAST)
9 | elseif op == "*" then
10 | r = a*b
11 | elseif op == "/" then
12 |
13 | Generator.maze:GetValue(coordinates.x - 1, coordinates.y):removeWall(EAST)
14 |
15 | r = a/b
16 | else
17 | error("invalid operation")
18 | end
19 |
20 | --98098098
21 | x = 0
--------------------------------------------------------------------------------
/src/LuaVSHost/Formatting/OptionPages/BaseDialogPage.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using Microsoft.VisualStudio.Shell;
4 |
5 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Formatting.OptionPages
6 | {
7 | internal abstract class BaseDialogPage : UIElementDialogPage
8 | {
9 | public override object AutomationObject
10 | {
11 | get
12 | {
13 | return UserSettings.MainInstance;
14 | }
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Shared/ICore.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using LanguageService;
3 | using Microsoft.VisualStudio.Editor;
4 |
5 | namespace Microsoft.VisualStudio.LuaLanguageService.Shared
6 | {
7 | internal interface ICore
8 | {
9 | GlobalEditorOptions GlobalEditorOptions { get; }
10 | IServiceProvider ServiceProvider { get; }
11 | IVsEditorAdaptersFactoryService EditorAdaptersFactory { get; }
12 | SourceTextCache SourceTextCache { get; }
13 | LuaFeatureContainer FeatureContainer { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/CorrectSampleLuaFiles/longs.lua:
--------------------------------------------------------------------------------
1 | ThisIsAVeryLongIdentifierNameItsSoLongThatItsSoLongICantThinkNowIAmTryingToMakeThisEqualToTenOrSomethingBecauseThatWillBeAwesome
2 | 12398193048193480123840918340918309481903480138409183094810934809138409183094810934810983409183049810923480193840918340918230948
3 | [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
4 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pulvinar ex in posuere malesuada. Vestibulum ante ipsum primis."
--------------------------------------------------------------------------------
/src/LuaVSHost/Formatting/OptionPages/UserControls/GeneralUserControl.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Windows.Controls;
4 |
5 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Formatting.OptionPages.UserControls
6 | {
7 | ///
8 | /// Interaction logic for GeneralUserControl.xaml
9 | ///
10 | public partial class GeneralUserControl : UserControl
11 | {
12 | public GeneralUserControl()
13 | {
14 | this.InitializeComponent();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Formatting/OptionPages/UserControls/SpacingUserControl.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Windows.Controls;
4 |
5 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Formatting.OptionPages.UserControls
6 | {
7 | ///
8 | /// Interaction logic for SpacingUserControl.xaml
9 | ///
10 | public partial class SpacingUserControl : UserControl
11 | {
12 | public SpacingUserControl()
13 | {
14 | this.InitializeComponent();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/LanguageModel/Classification/TagInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | namespace LanguageService.Classification
4 | {
5 | public class TagInfo
6 | {
7 | internal TagInfo(int start, int length, Classification classification)
8 | {
9 | this.Start = start;
10 | this.Length = length;
11 | this.Classification = classification;
12 | }
13 |
14 | public int Start { get; }
15 |
16 | public int Length { get; }
17 |
18 | public Classification Classification { get; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/ProjectLauncher/GuidList.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | namespace ProjectLauncher
4 | {
5 | using System;
6 |
7 | ///
8 | /// MUST match guids.h
9 | ///
10 | internal static class GuidList
11 | {
12 | public const string guidProjectLauncherPkgString = "933a507d-7abd-4a75-b906-895d8cc0616e";
13 | public const string guidProjectLauncherCmdSetString = "3ebc3be9-5f46-4b77-a2a3-73cfeb1a8791";
14 |
15 | public static readonly Guid guidProjectLauncherCmdSet = new Guid(guidProjectLauncherCmdSetString);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/LuaVSHost/Formatting/OptionPages/UserControls/WrappingAndNewLineUserControl.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Windows.Controls;
4 |
5 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Formatting.OptionPages.UserControls
6 | {
7 | ///
8 | /// Interaction logic for WrappingAndNewLineUserControl.xaml
9 | ///
10 | public partial class WrappingAndNewLineUserControl : UserControl
11 | {
12 | public WrappingAndNewLineUserControl()
13 | {
14 | this.InitializeComponent();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Navigation/IDocumentOperations.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Shell.Interop;
2 | using Microsoft.VisualStudio.Text;
3 | using Microsoft.VisualStudio.Text.Editor;
4 |
5 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Shared
6 | {
7 | internal interface IDocumentOperations
8 | {
9 | bool OpenDocument(string path, out bool isAlreadyOpen, out IWpfTextView textView);
10 | void NavigateTo(IWpfTextView textView, Span span, bool selectSpan, bool deferNavigationWithOutlining);
11 | bool GetAlreadyOpenedDocument(string path, out IVsWindowFrame windowFrame);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/LanguageModel/Formatting/Ruling/RuleOperation.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using Validation;
4 |
5 | namespace LanguageService.Formatting.Ruling
6 | {
7 | internal class RuleOperation
8 | {
9 | internal RuleOperationContext Context { get; }
10 |
11 | internal RuleAction Action { get; }
12 |
13 | internal RuleOperation(RuleOperationContext context, RuleAction action)
14 | {
15 | Requires.NotNull(context, nameof(context));
16 |
17 | this.Action = action;
18 | this.Context = context;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/TestGeneration/ValidatedGeneratedTests/EmptyProgram_Generated.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | namespace LanguageModel.Tests.GeneratedTestFiles
4 | {
5 | using LanguageModel.Tests.TestGeneration;
6 | using LanguageService;
7 | using Xunit;
8 |
9 | internal class EmptyProgram_Generated
10 | {
11 | [Fact]
12 | public void Test(Tester t)
13 | {
14 | t.N(SyntaxKind.ChunkNode);
15 | {
16 | t.N(SyntaxKind.BlockNode);
17 | t.N(SyntaxKind.EndOfFile);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: '{build}'
2 | branches:
3 | only:
4 | - master
5 | - /^v\d+(?:\.\d+)?$/
6 | - /[\b_]validate\b/
7 | skip_tags: true
8 | nuget:
9 | disable_publish_on_pr: true
10 | image: Visual Studio 2017
11 | environment:
12 | VisualStudioVersion: 15.0
13 | DeployExtension: false
14 | configuration: Release
15 | before_build:
16 | - ps: nuget restore src -Verbosity quiet
17 | build:
18 | verbosity: minimal
19 | test: off
20 | artifacts:
21 | - path: bin\Release\Microsoft.VisualStudio.LanguageServices.Lua.vsix
22 | name: Lua Language service
23 | - path: bin\%configuration%\LuaDebuggerLauncher.vsix
24 | name: Lua Debugger launcher
25 |
--------------------------------------------------------------------------------
/src/LanguageModel/Formatting/Ruling/Rule.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Collections.Generic;
4 |
5 | namespace LanguageService.Formatting.Ruling
6 | {
7 | internal abstract class Rule
8 | {
9 | internal abstract RuleDescriptor RuleDescriptor { get; }
10 |
11 | internal abstract RuleOperation RuleOperationContext { get; }
12 |
13 | internal abstract bool AppliesTo(FormattingContext formattingContext);
14 |
15 | internal abstract IEnumerable Apply(FormattingContext formattingContext);
16 |
17 | internal abstract Rule Inverse { get; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/LanguageModel/LanguageModel/ParseError.cs:
--------------------------------------------------------------------------------
1 | using Validation;
2 |
3 | namespace LanguageService
4 | {
5 | public class ParseError
6 | {
7 | public ParseError(string message, int start, int end)
8 | {
9 | Requires.NotNull(message, nameof(message));
10 |
11 | this.Message = message;
12 | this.Start = start;
13 | this.End = end;
14 | }
15 |
16 | public string Message { get; }
17 | public int Start { get; }
18 | public int End { get; }
19 |
20 | public int Length
21 | {
22 | get { return this.End - this.Start; }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Shared/ContentTypes.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.Composition;
2 | using Microsoft.VisualStudio.Utilities;
3 |
4 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Shared
5 | {
6 | internal static class ContentTypes
7 | {
8 | [Export]
9 | [Name(Constants.Language.Name)]
10 | [BaseDefinition("code")]
11 | internal static ContentTypeDefinition ContentType { get; set; }
12 |
13 | [Export]
14 | [FileExtension(Constants.Language.FileExtension)]
15 | [ContentType(Constants.Language.Name)]
16 | internal static FileExtensionToContentTypeDefinition LuaContentTypeExtensionDefinition { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/LuaVSHost/LuaLanguageService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Microsoft.VisualStudio.LuaLanguageService.Shared;
4 |
5 | namespace Microsoft.VisualStudio.LuaLanguageService
6 | {
7 | [Guid(Guids.ServiceString)]
8 | public sealed class LuaLanguageService : IServiceProvider
9 | {
10 | private IServiceProvider serviceProvider;
11 |
12 | public object GetService(Type serviceType)
13 | {
14 | return serviceProvider != null ? serviceProvider.GetService(serviceType) : null;
15 | }
16 |
17 | public LuaLanguageService(IServiceProvider serviceProvider)
18 | {
19 | this.serviceProvider = serviceProvider;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/LuaVSHost/LuaContentTypes.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Utilities;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel.Composition;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using VSLua.Shared;
9 |
10 | namespace VSLua
11 | {
12 | internal static class LuaContentTypes
13 | {
14 | [Export]
15 | [Name(Constants.LuaLanguageName)]
16 | [BaseDefinition("code")]
17 | internal static ContentTypeDefinition LuaContentType;
18 |
19 | [Export]
20 | [FileExtension(Constants.LuaFileExtension)]
21 | [ContentType(Constants.LuaLanguageName)]
22 | internal static FileExtensionToContentTypeDefinition LuaContentTypeExtensionDefintion;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/LanguageModel/Formatting/Options/OptionalRuleGroup.cs:
--------------------------------------------------------------------------------
1 | namespace LanguageService.Formatting.Options
2 | {
3 | public enum OptionalRuleGroup
4 | {
5 | WrappingOneLineForFors,
6 | WrappingOneLineForFunctions,
7 | WrappingOneLineForTableConstructors,
8 | WrappingMoreLinesForTableConstructors,
9 | SpaceBeforeOpenParenthesis,
10 | SpaceOnInsideOfParenthesis,
11 | SpaceOnInsideOfCurlyBraces,
12 | SpaceOnInsideOfSquareBrackets,
13 | SpaceAfterCommas,
14 | SpaceBeforeAndAfterBinaryOperations,
15 | SpaceBeforeAndAfterAssignmentForField,
16 | SpaceBeforeAndAfterAssignmentForStatement,
17 | SpaceBeforeAndAfterAssignmentInForLoopHeader,
18 | NoSpaceBeforeAndAfterIndiciesInForLoopHeader
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/LanguageModel/Text/SourceTextLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace LanguageService.Text
9 | {
10 | public class SourceTextLine
11 | {
12 | internal SourceTextLine(string text, int start, int length)
13 | {
14 | this.Text = text;
15 | this.Start = start;
16 | this.Length = length;
17 | this.End = start + length;
18 | }
19 |
20 | public string Text { get; }
21 |
22 | public int Start { get; }
23 |
24 | public int Length { get; }
25 |
26 | public int End { get; }
27 |
28 | public TextReader TextReader => new StringReader(this.Text);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/LanguageModel/Diagnostics/DiagnosticsProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Validation;
3 |
4 | namespace LanguageService.Diagnostics
5 | {
6 | internal class DiagnosticsProvider : IDiagnosticsProvider
7 | {
8 | private ParseTreeCache parseTreeCache;
9 |
10 | public DiagnosticsProvider(ParseTreeCache parseTreeCache)
11 | {
12 | Requires.NotNull(parseTreeCache, nameof(parseTreeCache));
13 |
14 | this.parseTreeCache = parseTreeCache;
15 | }
16 |
17 | public IReadOnlyList GetDiagnostics(SourceText sourceText)
18 | {
19 | Requires.NotNull(sourceText, nameof(sourceText));
20 |
21 | SyntaxTree syntaxTree = this.parseTreeCache.Get(sourceText);
22 |
23 | return syntaxTree.ErrorList;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.Debugger.Lua/Variable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.VisualStudio.Debugger.Lua
8 | {
9 | public class Variable
10 | {
11 | public Variable(string name, string value, string type)
12 | {
13 | this.Name = name;
14 | this.Value = value;
15 | this.Type = type;
16 | }
17 |
18 | public string Name { get; private set; }
19 |
20 | public string Value { get; private set; }
21 |
22 | public string Type { get; private set; }
23 |
24 | public List Children { get; private set; }
25 |
26 | public bool HasChildren()
27 | {
28 | return Children.Count > 0;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/LanguageModel.Tests/TestGeneration/UnvalidatedGeneratedTests/27_Generated.cs:
--------------------------------------------------------------------------------
1 | //C:\Users\t-kevimi\\Documents\\LuaTests\Lua Files for Testing\SemiColonStatement.lua
2 | namespace LanguageModel.Tests.GeneratedTestFiles
3 | {
4 | using LanguageModel.Tests.TestGeneration;
5 | using LanguageService;
6 | using Xunit;
7 |
8 | internal class Generated_27
9 | {
10 | [Fact]
11 | public void Test(Tester t)
12 | {
13 | t.N(SyntaxKind.ChunkNode);
14 | {
15 | t.N(SyntaxKind.BlockNode);
16 | {
17 | t.N(SyntaxKind.SemiColonStatementNode);
18 | {
19 | t.N(SyntaxKind.Semicolon);
20 | }
21 | }
22 | t.N(SyntaxKind.EndOfFile);
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/LanguageModel/Shared/Range.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | namespace LanguageService.Shared
4 | {
5 | ///
6 | /// Species a number range
7 | ///
8 | public struct Range
9 | {
10 | ///
11 | /// Specifies a number range
12 | ///
13 | /// The start index
14 | /// The end index, must be equal or
15 | /// greater than
16 | public Range(int start, int length)
17 | {
18 | this.Start = start;
19 | this.Length = length;
20 | this.End = start + length;
21 | }
22 |
23 | public int Start { get; }
24 |
25 | public int End { get; }
26 |
27 | public int Length { get; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.Debugger.Lua/Frame.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Microsoft.VisualStudio.Debugger.Lua
8 | {
9 | internal class Frame
10 | {
11 | private string m_func;
12 | private string m_src;
13 | private string m_line;
14 |
15 | public Frame(string funcName, string src, string line)
16 | {
17 | m_func = funcName;
18 | m_src = src;
19 | m_line = line;
20 | }
21 |
22 | public string GetFunc()
23 | {
24 | return m_func;
25 | }
26 |
27 | public string GetSource()
28 | {
29 | return m_src;
30 | }
31 |
32 | public string GetLine()
33 | {
34 | return m_line;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/LanguageModel/Formatting/Ruling/RuleAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | namespace LanguageService.Formatting.Ruling
4 | {
5 | ///
6 | /// The set of enumerables that describes all the possible Rule actions
7 | ///
8 | internal enum RuleAction
9 | {
10 | ///
11 | /// Action that enforces one space between tokens
12 | ///
13 | Space,
14 |
15 | ///
16 | /// Action that removes spaces between tokens
17 | ///
18 | Delete,
19 |
20 | ///
21 | /// Action that inserts a newline between tokens
22 | ///
23 | Newline,
24 |
25 | ///
26 | /// Action that enforces nothing is done
27 | ///
28 | Ignore // <- Might not be needed
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/LanguageModel/ParseTreeCache.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Runtime.CompilerServices;
4 | using Validation;
5 |
6 | namespace LanguageService
7 | {
8 | public class ParseTreeCache
9 | {
10 | private readonly ConditionalWeakTable sources =
11 | new ConditionalWeakTable();
12 |
13 | public SyntaxTree Get(SourceText sourceText)
14 | {
15 | Requires.NotNull(sourceText, nameof(sourceText));
16 |
17 | SyntaxTree syntaxTree;
18 | if (this.sources.TryGetValue(sourceText, out syntaxTree))
19 | {
20 | return syntaxTree;
21 | }
22 |
23 | syntaxTree = Parser.Parse(sourceText.TextReader);
24 | this.sources.Add(sourceText, syntaxTree);
25 |
26 | return syntaxTree;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Intellisense/CompletionSourceProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Composition;
3 | using Microsoft.VisualStudio.Language.Intellisense;
4 | using Microsoft.VisualStudio.Shell;
5 | using Microsoft.VisualStudio.Text;
6 | using Microsoft.VisualStudio.Text.Operations;
7 | using Microsoft.VisualStudio.Utilities;
8 |
9 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Intellisense
10 | {
11 | [Export(typeof(ICompletionSourceProvider))]
12 | [ContentType("lua")]
13 | [Name("token completion")]
14 | internal class CompletionSourceProvider : ICompletionSourceProvider
15 | {
16 | [Import]
17 | internal ITextStructureNavigatorSelectorService NavigatorService { get; set; }
18 | public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
19 | {
20 | return new CompletionSource(this, textBuffer);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/ProjectLauncher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System;
4 | using System.Reflection;
5 | using System.Resources;
6 | using System.Runtime.CompilerServices;
7 | using System.Runtime.InteropServices;
8 |
9 | // General Information about an assembly is controlled through the following
10 | // set of attributes. Change these attribute values to modify the information
11 | // associated with an assembly.
12 | [assembly: AssemblyTitle("ProjectLauncher")]
13 | [assembly: AssemblyDescription("")]
14 | [assembly: AssemblyConfiguration("")]
15 | [assembly: AssemblyCompany("Microsoft")]
16 | [assembly: AssemblyProduct("ProjectLauncher")]
17 | [assembly: AssemblyCopyright("Copyright © Microsoft")]
18 | [assembly: AssemblyTrademark("Copyright © Microsoft")]
19 | [assembly: AssemblyCulture("")]
20 | [assembly: ComVisible(false)]
21 | [assembly: CLSCompliant(false)]
22 | [assembly: NeutralResourcesLanguage("en-US")]
23 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Shared/ISingletons.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using LanguageService;
3 | using Microsoft.VisualStudio.Editor;
4 | using Microsoft.VisualStudio.LanguageServices.Lua.Classifications;
5 | using Microsoft.VisualStudio.LanguageServices.Lua.Formatting;
6 | using Microsoft.VisualStudio.LanguageServices.Lua.Text;
7 | using Microsoft.VisualStudio.Text.Operations;
8 |
9 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Shared
10 | {
11 | internal interface ISingletons
12 | {
13 | IDocumentOperations DocumentOperations { get; }
14 |
15 | IEditorOperationsFactoryService EditorOperationsFactory { get; }
16 |
17 | IVsEditorAdaptersFactoryService EditorAdaptersFactory { get; }
18 |
19 | LuaFeatureContainer FeatureContainer { get; }
20 |
21 | UserSettings FormattingUserSettings { get; }
22 |
23 | IServiceProvider ServiceProvider { get; }
24 |
25 | SourceTextCache SourceTextCache { get; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/LanguageModel/Formatting/Ruling/RuleBucket.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Collections.Generic;
4 |
5 | namespace LanguageService.Formatting.Ruling
6 | {
7 | internal class RuleBucket
8 | {
9 | private List rules;
10 |
11 | // This methods is here for when I need to add precedence to the rules
12 | internal void Add(Rule rule)
13 | {
14 | if (this.rules == null)
15 | {
16 | this.rules = new List();
17 | }
18 |
19 | this.rules.Add(rule);
20 | }
21 |
22 | internal Rule Get(FormattingContext formattingContext)
23 | {
24 | foreach (Rule rule in this.rules)
25 | {
26 | if (rule.AppliesTo(formattingContext))
27 | {
28 | return rule;
29 | }
30 | }
31 |
32 | return null;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Formatting/SmartIndentation/SmartIndentProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel.Composition;
6 | using Microsoft.VisualStudio.LanguageServices.Lua.Shared;
7 | using Microsoft.VisualStudio.Text.Editor;
8 | using Microsoft.VisualStudio.Utilities;
9 |
10 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Formatting.SmartIndentation
11 | {
12 | [Export(typeof(ISmartIndentProvider))]
13 | [ContentType(Constants.Language.Name)]
14 | [Name("LuaSmartIndentation")]
15 | internal class SmartIndentProvider : ISmartIndentProvider
16 | {
17 | #pragma warning disable 0169, 0649
18 | [Import]
19 | private ISingletons singletons;
20 | #pragma warning restore 0169, 0649
21 |
22 | public ISmartIndent CreateSmartIndent(ITextView textView)
23 | {
24 | return new SmartIndent(textView, this.singletons);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/LuaDebuggerLauncher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft. All rights reserved.
2 |
3 | using System.Reflection;
4 | using System.Runtime.CompilerServices;
5 | using System.Runtime.InteropServices;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("LuaDebuggerLauncher")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("LuaDebuggerLauncher")]
15 | [assembly: AssemblyCopyright("")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
--------------------------------------------------------------------------------
/src/LanguageModel/Formatting/Options/GlobalOptions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Immutable;
2 | using Validation;
3 |
4 | namespace LanguageService.Formatting.Options
5 | {
6 |
7 | internal class GlobalOptions
8 | {
9 | internal GlobalOptions(NewOptions options)
10 | {
11 | Requires.NotNull(options, nameof(options));
12 | this.IndentSize = options.IndentSize;
13 | this.TabSize = options.TabSize;
14 | this.UsingTabs = options.UsingTabs;
15 | this.OptionalRuleMap = new OptionalRuleMap(options.RuleGroupsToDisable);
16 | }
17 |
18 | internal GlobalOptions()
19 | {
20 | IndentSize = 4;
21 | OptionalRuleMap = new OptionalRuleMap(ImmutableArray.Create());
22 | }
23 |
24 | internal uint IndentSize { get; }
25 | internal uint TabSize { get; }
26 | internal bool UsingTabs { get; }
27 | internal OptionalRuleMap OptionalRuleMap { get; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/LuaVSHost/Errors/TaskExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 |
4 | namespace Microsoft.VisualStudio.LanguageServices.Lua.Errors
5 | {
6 | internal static class TaskExtensions
7 | {
8 | internal static Task WithoutCancellation(this Task task)
9 | {
10 | Requires.NotNull(task, nameof(task));
11 |
12 | var tcs = new TaskCompletionSource