Why is my .editorconfig file being ignored? - visual-studio-mac

I am using Visual Studio for Mac, 8.3.4 (build 8)
I have a very simple Visual Studio solution with one small project. I followed the docs exactly to create my .editorconfig file, but when I do Edit -> Format -> Format Document, my options are ignored.
This is my .editorconfig file:
root = true
[*]
indent_style = space
indent_size = 20
insert_final_newline = true
trim_trailing_whitespace = false
And here is proof it is in the correct location:

Related

Remove TFS references from my console application

I inadvertently added my new console application to TFS (I didn't even check it in) and now it tries to connect to TFS when I open the solution.
What do I need to remove TFS references from my console application?
Open up your solution (.sln) file in notepad. Remove the section that has references to Scc like below
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://mytfs:8080/tfs/ieb
SccLocalPath0 = .
SccProjectUniqueName1 = ConsoleApp3\\ConsoleApp3.csproj
SccProjectName1 = ConsoleApp3
SccLocalPath1 = ConsoleApp3
EndGlobalSection
Also, remove the .vssscc file from the directory where your Solution (.sln) file directory.

F# FSI, Change working directory

I have the following file located in a "New Folder" of Desktop:
// File location: "C:\Users\my_user_name\Desktop\New folder\AddOne.fs"
//
module internal AddOneModule
let AddOneFunction x = x + 1
I can access this file by using #load on the full path name using FSI F# Interactive.
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> #load "C:\Users\my_user_name\Desktop\New folder\AddOne.fs";;
//[Loading C:\Users\my_user_name\Desktop\New folder\AddOne.fs]
//namespace FSI_0002
// val AddOneFunction : x:int -> int
> open AddOneModule;;
> AddOneFunction 100;;
// val it : int = 101
How do I change the working directory so that I can access the file using relative path?
F# interactive:how to display/change current working directory
I tried something similar to the post above, but FSI still tries to find the file in the Temp folder:
(RESET FSI)
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> open System;;
> Environment.CurrentDirectory <- #"C:\Users\my_user_name\Desktop\New folder";;
//val it : unit = ()
> #load "AddOne.fs";;
// #load "AddOne.fs";;
// ^^^^^^^^^^^^^^^^^
//C:\Users\my_user_name\Desktop\New folder\stdin(3,1): error FS0078: Unable to find
//the file 'AddOne.fs' in any of
// C:\Users\my_user_name\AppData\Local\Temp
Thank you for your help.
Instead of changing the working directory you may achieve the desired using a trick with __SOURCE_DIRECTORY__ built-in identifier.
To begin with, you need a certain anchor point in directory structure. For illustration purposes let's assume you are on Windows and let this anchor point be your user directory, which is defined by %USERPROFILE% environment variable. Place there a script anchorfsi.fsx containing the following single line of code:
#I __SOURCE_DIRECTORY__
That's basically all you need to do. Now, regardless from what location you shoot your fsi using command line fsi --load:%USERPROFILE%\anchorfsi.fsx, you can use relative paths in your scripts and in interactive commands.
Turning to the setup in your question with loading .\desktop\new folder\addone.fs, the following screenshot demonstrates achieving the desired:
Notice how the entered relative path ".\desktop\new folder\addone.fs" was correctly mapped to the absolute one C:\Users\gene\desktop\new folder\addone.fs without any dependency upon the fsi working directory whatsoever.

#load a package in F# interactive (FSharpChart.fsx)

Hi i'm a noob and asking this newbie question, please forgive me.
I've installed successfully FSharpChart in my local directory
...
Added package 'MSDN.FSharpChart.dll.0.60.0' to folder 'C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Expert in F\packages'
Added package 'MSDN.FSharpChart.dll.0.60.0' to 'packages.config'
Successfully installed 'MSDN.FSharpChart.dll 0.60.0' to Expert in F
now, if i do
#load "FSharpChart.fsx";;
^^^^^^^^^^^^^^^^^^^^^^^
stdin(4,1): error FS0078: Unable to find the file 'FSharpChart.fsx' in any of
C:\Users\Fagui\AppData\Local\Temp
additional info:
inside this folder, i see a nupkg file, and a lib directory
Inside the lib directory, there is a dll, and a pdf file,
but i don't see any .fsx file.
basically, F# has installed the package in the active folder for the current project, and F#interactive is in another folder ?? bit strange ?
should i install another time the package ? or what is the way around it ?
thanks
UPDATE:
i don't know why, but apparently when i installed the FSharpChart package, I only got the dll, no fsx file
i managed to load it doing
#I #"C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Expert in F"
#r #"packages\MSDN.FSharpChart.dll.0.60\lib\MSDN.FSharpChart.dll";;
unfortunately, typing the script in F# interactive
open MSDN.FSharp.Charting
let rnd = System.Random()
let rand() = rnd.NextDouble()
let randomPoints = [for i in 0 .. 1000 -> 10.0 * rand(), 10.0 * rand()]
randomPoints |> FSharpChart.Point;;
doesn't yield any chart, but just returns a list
val rnd : Random
val rand : unit -> float
val randomPoints : (float * float) list =
[(9.765916457, 2.272289941); (0.8211438594, 1.625466995);
...
(7.783786034, 7.572208311); (6.497914692, 3.66987128); ...]
val it : ChartTypes.PointChart
this may be due to the fact that the library is not supported anymore, and that i should use a newer library like Thomas Petricek indicated.
So, i did manage to install FSharp.Charting instead
let rnd = System.Random()
let rand() = rnd.NextDouble()
let randomPoints = [for i in 0 .. 1000 -> 10.0 * rand(), 10.0 * rand()]
randomPoints |> Chart.Point;;
and it did work
There is a newer version of the FSharpChart.fsx library which is called F# Charting, so first of all, I would recommend using this newer library instead (the API is quite similar, but F# Charting has a number of improvements).
The documentation for F# Charting also has a detailed page on referencing the library.
Typically, when you reference the library using NuGet, you'll need to specify relative reference:
// On Mac OSX use packages/FSharp.Charting.Gtk.0.90.13/FSharp.Charting.Gtk.fsx
#load "packages/FSharp.Charting.0.90.13/FSharp.Charting.fsx"
Where 0.90.13 is the version of the library that you got from NuGet (you may need to check the folder name - the path references in #load are relative to the place where your script lives).
Yes, F# Interactive is independent of the current project.
Use:
#load #"C:\Users\Fagui\Documents\GitHub\Learning Fsharp\Expert in F\packages\FSharpChart.fsx";;
Also you can use the #I directive if you need to reference assemblies of a specific folder, see the reference.

How do I disable assertions for the entire project?

I have some code in Delphi that has Assert statements all over it. I know that there is a compiler directive {$C-}, but there are too many units to add it to. Is there a way to have it done by the compiler command line or somewhere in the dpr file?
You can use $C- from the command line as well, or configure it in 'Project->Options->Compiler' from the IDE (which configures it in the .dproj file).
There's a list of command line switches and options available by typing dcc32 from the command line. It can be redirected to a text file using command redirection (as in dcc32 > dccCommands.txt), which produces the following output with XE5's version of dcc32:
Embarcadero Delphi for Win32 compiler version 26.0
Copyright (c) 1983,2013 Embarcadero Technologies, Inc.
Syntax: dcc32 [options] filename [options]
-A<unit>=<alias> = Set unit alias
-B = Build all units
-CC = Console target
-CG = GUI target
-D<syms> = Define conditionals
-E<path> = EXE/DLL output directory
-F<offset> = Find error
-GD = Detailed map file
-GP = Map file with publics
-GS = Map file with segments
-H = Output hint messages
-I<paths> = Include directories
-J = Generate .obj file
-JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all
-JL = Generate package .lib, .bpi, and all .hpp files for C++
-K<addr> = Set image base addr
-LE<path> = package .bpl output directory
-LN<path> = package .dcp output directory
-LU<package> = Use package
-M = Make modified units
-NU<path> = unit .dcu output directory
-NH<path> = unit .hpp output directory
-NO<path> = unit .obj output directory
-NB<path> = unit .bpi output directory
-NX<path> = unit .xml output directory
-NS<namespaces> = Namespace search path
-O<paths> = Object directories
-P = look for 8.3 file names also
-Q = Quiet compile
-R<paths> = Resource directories
-TX<ext> = Output name extension
-U<paths> = Unit directories
-V = Debug information in EXE
-VR = Generate remote debug (RSM)
-VT = Debug information in TDS
-VN = TDS symbols in namespace
-W[+|-|^][warn_id] = Output warning messages
-Z = Output 'never build' DCPs
-$<dir> = Compiler directive
--help = Show this help screen
--version = Show name and version
--codepage:<cp> = specify source file encoding
--default-namespace:<namespace> = set namespace
--depends = output unit dependency information
--doc = output XML documentation
--drc = output resource string .drc file
--no-config = do not load default dcc32.cfg file
--description:<string> = set executable description
--inline:{on|off|auto} = function inlining control
--legacy-ifend = allow legacy $IFEND directive
--zero-based-strings[+|-] = strings are indexed starting at 0
--peflags:<flags> = set extra PE Header flags field
--peoptflags:<flags> = set extra PE Header optional flags field
--peosversion:<major>.<minor> = set OS Version fields in PE Header (default: 5.0)
--pesubsysversion:<major>.<minor> = set Subsystem Version fields in PE Header (default: 5.0)
--peuserversion:<major>.<minor> = set User Version fields in PE Header (default: 0.0)
Compiler switches: -$<letter><state> (defaults are shown below)
A8 Aligned record fields
B- Full boolean Evaluation
C+ Evaluate assertions at runtime
D+ Debug information
G+ Use imported data references
H+ Use long strings by default
I+ I/O checking
J- Writeable structured consts
L+ Local debug symbols
M- Runtime type info
O+ Optimization
P+ Open string params
Q- Integer overflow checking
R- Range checking
T- Typed # operator
U- Pentium(tm)-safe divide
V+ Strict var-strings
W- Generate stack frames
X+ Extended syntax
Y+ Symbol reference info
Z1 Minimum size of enum types
Stack size: -$M<minStackSize[,maxStackSize]> (default 16384,1048576)

Using other editor with TortoiseHg

I'm trying to use other editor with TortoiseHG, instead of (Windows) Notepad.
I have tried the solutions mentioned here:
Mercurial and Notepad++ Integration
and here:
https://bitbucket.org/tortoisehg/thg/wiki/OpenAtLine
But no results. When I right-click a file and choose "Edit Local" no file is opened at all, except when I don't set any specific editor (then file is opened in Notepad).
I have tried different editors, like Notepad++ and Sublime Text 2, and no result. Also, I tried to change configuration using "Setting" in GUI, and editing "C:\Users\<my_user>\mercurial.ini"
For example, I tried:
#### # For Sublime Text 2
[tortoisehg]
editor = C:\Program Files\Sublime Text 2\sublime_text.exe [$FILE:$LINENUM]
#### # Or, for NotePad++ :
[tortoisehg]
editor = C:\Program Files (x86)\Notepad++\Notepad++.exe ["$FILE" -n$LINENUM] -multiInst -nosession
What I'm doing wrong?
You'll kick yourself...
Change:
[tortoisehg]
editor = C:\Program Files (x86)\Notepad++\Notepad++.exe ["$FILE" -n$LINENUM] -multiInst -nosession
To:
[tortoisehg]
editor = "C:\Program Files (x86)\Notepad++\Notepad++.exe" ["$FILE" -n$LINENUM] -multiInst -nosession
Note the additional quotes around the path to Notepad++.
I'm guessing it's exactly the same issue with your path to Sublime Text too as both paths contain a space.
Strange editor = C:\Program Files (x86)\Notepad++\Notepad++.exe without double quotes worked for me

Resources