Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcsh syntax highlighting partially broken #2638

Open
vvzen opened this issue Jun 1, 2022 · 8 comments
Open

tcsh syntax highlighting partially broken #2638

vvzen opened this issue Jun 1, 2022 · 8 comments
Labels
A-language-support Area: Support for programming/text languages C-bug Category: This is a bug

Comments

@vvzen
Copy link

vvzen commented Jun 1, 2022

Summary

Hi all!
And thanks for this beatiful project. I absolutely love it!

While editing a tcsh file with hx, I noticed that the syntax highlighting was having troubles with an unescaped ' character.
This is what I see in hx:
Screen Shot 2022-06-01 at 15 19 03

This is what I see in neovim, instead:
Screen Shot 2022-06-01 at 15 19 13

I suppose that's because hx doesn't support tcsh natively?
If so, I'd like to contribute to it but I don't know where to start.
Thanks!

PS: don't ask why I still need to use tcsh in 2022, I'm forced to since it's what we have at work :|

Platform

CentOS Linux release 7.9.2009 (Core)

Terminal Emulator

iterm2

Helix Version

helix 22.03

@vvzen vvzen added the C-bug Category: This is a bug label Jun 1, 2022
@the-mikedavis
Copy link
Member

I believe this was fixed in #1917

Can you try updating to 22.05?

@vvzen
Copy link
Author

vvzen commented Jun 1, 2022

ah, great! will give it a go and let you know, thanks!

@vvzen
Copy link
Author

vvzen commented Jun 1, 2022

tried in 22.05 - same behaviour. I think that it's just that tcsh isn't supported, right now?

$ hx --version
helix 22.05
$ hx --health tcsh
Language 'tcsh' not found
Did you mean one of these: toml, typescript, tsx, twig, tsq, tablegen, tfvars 

@the-mikedavis
Copy link
Member

There isn't any support at the moment but it might be possible to use tree-sitter-bash for it like we do with zsh. Could you post the entire file from the screenshot or a minimal version? Is there a shebang at the top that's selecting the language?

@vvzen
Copy link
Author

vvzen commented Jun 1, 2022

It does have a shebang, yes. This is another.tcsh file, but the gist is the same:

#!/bin/tcsh -e

set python_version_no_dots=`echo ${CM_PYTHON_VERSION} | tr -d "."`
set modulename="third-party-libs-devel-python-${python_version_no_dots}"
printf "Loading $modulename module.."
module load "$modulename"
printf "..done!\n"

# Load custom python
printf "Loading custom python/$CM_PYTHON_VERSION module.."
module load "/net/global/opt/pipeline/python-payloads/modules/python/$CM_PYTHON_VERSION"
printf "..done!\n"

module list
printf "\n"

echo "Current PATH:"
echo "$PATH" | tr ":" "\n"

echo "Current PYTHONPATH:"
echo "$PYTHONPATH" | tr ":" "\n"

echo "Current PL_CONFIG_PATH:"
echo $PL_CONFIG_PATH | tr ":" "\n"

set python="python${CM_PYTHON_VERSION}" 

printf "Running default Unit Test suite for Python $CM_PYTHON_VERSION with pytest..\n"
"$python" -m pytest "./$CM_UNIT_TESTS_DIR" -m "$CM_PYTEST_MARKS" \
    -vvv \
    --cov=$CM_PACKAGE_NAME \
    --junitxml=$CM_JUNIT_REPORT_NAME

# See https://docs.pytest.org/en/latest/reference/exit-codes.html
set code = $?
if $code != 0 then
    printf "Unit Tests didn't pass!\n"
    exit 1
endif
printf "..done!\n"

printf "Running additional custom tests..\n"

echo "--> Running tests using $python.."
"$python" ./ci-scripts/run_tests.py
set code = $?
if $code != 0 then
    echo "Additional unit tests didn't pass.\n"
    exit 1
endif

# This is used by https://docs.gitlab.com/13.12/ee/user/project/merge_requests/test_coverage_visualization.html
echo "--> Running coverage report.."
coverage report
coverage xml

echo "All done!"

@the-mikedavis
Copy link
Member

It looks like the

if $code != 0 then

line is what puts the parser into error mode. I don't write that much shell but I think bash needs brackets around if conditions and then a newline or ; between the condition and the then, right? So I think we can't use tree-sitter-bash for tcsh

@lebakasable
Copy link

https://github.com/hyperupcall/tree-sitter-tcsh

@kirawi kirawi added the A-language-support Area: Support for programming/text languages label Nov 10, 2022
@victororlyk
Copy link

I have the same problem with next script.sh file

#!/usr/bin/env bash
set -x
set -eo pipefail
if ! [ -x "$(command -v psql)" ]; then
  echo >&2 "Error: psql is not installed."
  exit 1
fi
if ! [ -x "$(command -v sqlx)" ]; then
  echo >&2 "Error: sqlx is not installed."
  echo >&2 "Use:"
  echo >&2 "    cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres"
  echo >&2 "to install it."
  exit 1
fi
DB_USER=${POSTGRES_USER:=postgres}
DB_PASSWORD="${POSTGRES_PASSWORD:=password}"
DB_NAME="${POSTGRES_DB:=newsletter}"
DB_PORT="${POSTGRES_PORT:=5432}"

# Allow to skip Docker if a dockerized Postgres database is already running
if [[ -z "${SKIP_DOCKER}" ]]
then
  docker run \
      -e POSTGRES_USER=${DB_USER} \
      -e POSTGRES_PASSWORD=${DB_PASSWORD} \
      -e POSTGRES_DB=${DB_NAME} \
      -p "${DB_PORT}":5432 \
      -d postgres \
      postgres -N 1000
fi
export PGPASSWORD="${DB_PASSWORD}"
until psql -h "localhost" -U "${DB_USER}" -p "${DB_PORT}" -d "postgres" -c '\q'; do
  >&2 echo "Postgres is still unavailable - sleeping"
sleep 1 done

>&2 echo "Postgres is up and running on port ${DB_PORT} - running migrations now!"

export DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}
sqlx database create
sqlx migrate run

>&2 echo "Postgres has been migrated, ready to go!"

Screenshot 2023-02-10 at 20 06 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

5 participants