GithubHelp home page GithubHelp logo

azure-pipelines-language-server's Introduction

Build status

Build Status

Features

  1. YAML validation:
    • Detects whether the entire file is valid yaml
  2. Validation:
    • Detects errors such as:
      • Node is not found
      • Node has an invalid key node type
      • Node has an invalid type
      • Node is not a valid child node
    • Detects warnings such as:
      • Node is an additional property of parent
  3. Auto completion:
    • Auto completes on all commands
    • Scalar nodes autocomplete to schema's defaults if they exist
  4. Hover support:
    • Hovering over a node shows description if available
  5. Document outlining:
    • Shows a complete document outline of all nodes in the document
  6. Go to definition for Templates
    • Referenced templates can be resolved to a local file (if it exists)

Developer Support

This repo consists of 2 separate projects/packages:

In order to tighten the dev loop you can utilize npm link that will sync changes to service package without re-installing.

  1. First, install dependencies in the language service and start watching for changes:
    • cd language-service
    • npm install
    • npm run watch
  2. Next, link the language service to the language server and start watching for changes:
    • cd ../language-server
    • npm install
    • npm link ../language-service
    • npm run watch
  3. Now, any changes you make in the service will automatically be reflected in the server

Connecting to the language server via stdio

There's an option to connect to the language server via stdio to help with intergrating the language server into different clients.

Thanks

This project was forked from the YAML Language Server by Red Hat.

azure-pipelines-language-server's People

Contributors

50wliu avatar 928pjy avatar alexravenna avatar andxu avatar apupier avatar concaf avatar dependabot[bot] avatar dergacheve avatar dmitriibobreshev avatar erjohnms avatar gorkem avatar iquiw avatar ivanduplenskikh avatar joscol avatar jpinkney avatar mickaelistria avatar microsoft-github-policy-service[bot] avatar paultaykalo avatar rcjsuen avatar rsemenov avatar stephenmichaelf avatar stuart-wilcox avatar vtbassmatt avatar williamboman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-pipelines-language-server's Issues

Third-party notice file in the language server

We added ThirdPartyNotice.txt file to the language server and service. I'm trying to figure out how we comply with the requirement to make this file available at runtime. The internal policy site talks about things like "about box" and other UI constructs that the language server doesn't provide.

THIRD PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize

This software incorporates material from third parties. Microsoft makes certain 
open source code available at http://3rdpartysource.microsoft.com, or you may 
send a check or money order for US $5.00, including the product name, the open 
source component name, and version number, to:

Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA

Notwithstanding any other terms, you may reverse engineer this software to the 
extent required to debug changes to any libraries licensed under the GNU Lesser 
General Public License.
---
Component. Red Hat YAML Language Server

Open Source License/Copyright Notice:. MIT License

Copyright (c) 2017 Red Hat Inc. and others.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Additional Attribution: Gorkem Ercan (Red Hat), Joshua Pinkney ([email protected])

Add validation and hover support for template expressions

Currently, the language server does not provide appreciable support for the template expression syntax used between ${{ and }}. It would be a great quality of life improvement if the language server could include support for those objects.

Change on settings for the LS are not clear on the documentation.

Up to 0.7.0 I was able to use the language server with a good setup on Neovim with mason_lsp_config and attach the server to my files. After the recent updates I'm getting some error messages when I try to use it, yet I didn't see any warning about breaking changes.

Neovim Version: 0.9.5
I had the same errors running on ubuntu 23.04 natively and 22.04 on WSL

I installed the LSP from Mason and was running it with this config:

--- Setup Mason LSP Install
require("mason").setup({})
require("mason-lspconfig").setup({
	ensure_installed = {
		"azure_pipelines_ls",
         }
	handlers = {
		lsp.default_setup,
		azure_pipelines_ls = function()
			require("lspconfig").azure_pipelines_ls.setup(my_handlers.azure())
		end,
	},

Here is the handlers config returning the LS options table:

local M = {}
function M.azure()
	local opts = {
		settings = {
			yaml = {
				schemas = {
					["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = {
						"/azure-pipeline*.y*l",
						"/*.azure*",
						"Azure-Pipelines/**/*.y*l",
						"Pipelines/*.y*l",
						"cap/**/*.y*l",
						"cap/*.y*l",
						"veiling/**/*.y*l",
						"veiling/*.y*l",
					},
				},
			},
		},
	}
	return opts
end
return M

From 0.8.0 onwards I get an assertion error when the nvim lsp client tries to start the language server.

Status of the fork

Hello, I'd like to ask what the motivation is for this fork. I assume it's to support some features that Azure Pipelines uses that aren't standard YAML/JSON? Or to customize the performance/parsing in other ways?

Are there any plans to sync this fork with the Red Hat upstream repo? It looks like the last commit from upstream was in 2018. Since then there have been numerous improvements/bugfixes that are not reflected on this fork. Likewise, there are improvements/bugfixes on this fork that are not reflected upstream.

I'm a user of LSP, but I don't consume the language server from VSCode, so this situation was a bit confusing for me when I tried to use the normal yaml-language-server to parse Azure Pipelines yaml. Even now that I'm aware of this fork, it's very difficult to configure my editor to use your language server for certain files and the upstream language server for others.

If a major purpose of this fork is to implement non-standard JSON/YAML features, have you considered trying to make those features standard? One non-standard feature that I've noticed is Azure Pipeline's use of aliases, and there's discussion over on json-schema-org about making that part of the spec. Perhaps one of the maintainers of this fork could weigh in on that conversation?

Thank you in advance for any clarification you can provide.

Feature flag: Implement tasks version checking

Type: Feature

Related issue: microsoft/azure-pipelines-vscode#206

Description:

The Azure-pipelines vscode extension requires to support the feature flag provided from the config, that stored in the settings.json vscode user config.

This should activate the feature which will search the last versions of the tasks from the tasks schema file by enums matching

This flag will be sent from the client to the server and should be handled

Possible solution:

  • Add support of the flags provided by the client. As I know, it should be realized at the server and service both
  • Create a matching function which will search the last versions of the tasks from schema enums. If the current task didn't in the last versions list, add the alert like here with providing the new task version

What are the transforms applied to data in the YAML parser?

I'm reading the code which was introduced in #93 and seems to have been refined several times (e.g. #114) since then.
My goal is to reimplement this same transform for a tool which I maintain (the check-jsonschema hook for pre-commit) so that it can process pipelines with expressions in them at least as well as the language-service here does.

However, as I dig into the expression handling, I'm not clear about what some of the transformation is actually doing.
e.g. This case for an expression with a null value is hard to understand.

Is there any kind of internal documentation -- or just plain old advice -- which the maintainers can offer me on this?
Any help understanding the rewrites done by the parser would be very useful.


In case it's of interest, my python implementation can be seen here.

Language server crashes when pasting certain text

I have a pipeline with the following content:

          - task: PowerShellOnTargetMachines@3
            inputs:
              Machines: EXAMPLE
              InlineScript: |
                
              CommunicationProtocol: Http

I try to paste this text: [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null

This is the resulting content:

          - task: PowerShellOnTargetMachines@3
            inputs:
              Machines: EXAMPLE
              InlineScript: |
              [System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
              CommunicationProtocol: Http

The language server crashes, and it is always reproducible. Perhaps of significance, the indentation I initially have is reduced by two spaces when pasting.

[Error - 17:45:27] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read properties of undefined (reading 'startsWith')
  Code: -32603 
c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876
        if (property.key.value.startsWith("${{") && property.key.value.endsWith("}}")) {
                               ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876:32)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at addItemsToArrayNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1929:28)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1814:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
[Info  - 17:45:28] Connection to server got closed. Server will restart.
[Error - 17:45:28] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read properties of undefined (reading 'startsWith')
  Code: -32603 
c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876
        if (property.key.value.startsWith("${{") && property.key.value.endsWith("}}")) {
                               ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876:32)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at addItemsToArrayNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1929:28)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1814:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
[Info  - 17:45:28] Connection to server got closed. Server will restart.
[Error - 17:45:28] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read properties of undefined (reading 'startsWith')
  Code: -32603 
c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876
        if (property.key.value.startsWith("${{") && property.key.value.endsWith("}}")) {
                               ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876:32)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at addItemsToArrayNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1929:28)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1814:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
[Info  - 17:45:28] Connection to server got closed. Server will restart.
[Error - 17:45:29] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read properties of undefined (reading 'startsWith')
  Code: -32603 
c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876
        if (property.key.value.startsWith("${{") && property.key.value.endsWith("}}")) {
                               ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876:32)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at addItemsToArrayNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1929:28)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1814:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
[Info  - 17:45:29] Connection to server got closed. Server will restart.
[Error - 17:45:29] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Cannot read properties of undefined (reading 'startsWith')
  Code: -32603 
[Error - 17:45:29] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot read properties of undefined (reading 'startsWith')
  Code: -32603 
c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876
        if (property.key.value.startsWith("${{") && property.key.value.endsWith("}}")) {
                               ^

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1876:32)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
    at addItemsToArrayNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1929:28)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1814:13)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1806:48)
    at addPropertiesToObjectNode (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1883:30)
    at recursivelyBuildAst (c:\Users\stijn.herreman\.vscode\extensions\ms-azure-devops.azure-pipelines-1.208.0\dist\server.js:1794:13)
[Error - 17:45:29] Connection to server got closed. Server will not be restarted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.